<%@ page import="weaver.general.BaseBean" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="cn.hutool.core.date.DateUtil" %>
<%@ page import="java.time.LocalDateTime" %>
<%@ page import="cn.hutool.core.util.StrUtil" %>
<%@ page import="cn.hutool.core.date.DateTime" %>
<%@ page import="cn.hutool.core.date.DateField" %>
<%@ page import="java.util.*" %>
<%@ page import="java.util.concurrent.atomic.AtomicReference" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.stream.Collectors" %>
<%@ page import="java.util.concurrent.ExecutorService" %>
<%@ page import="java.util.concurrent.Executors" %>
<%@ page import="java.util.concurrent.Future" %>
<%@ page import="weaver.integration.util.JSONUtil" %>
<%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %>
<%@ page import="weaver.general.StringUtil" %>
<%@ page import="org.apache.regexp.RE" %>
<%@ page import="weaver.file.Prop" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%!
    String engListhTilte = getTilteEnglishTilte();
    private   Log logger1 = LogFactory.getLog("ihg");
//    Logger logger1 = LoggerFactory.getLogger("ihgJsp", String.valueOf(this.getClass()));
%>
<%!
    public void excuteSupporetRole( StringBuilder cjRHrmresouce,Log baseBean,Integer inncodeID,StringBuilder znbscjgwStr,String filedName,String tableName){
//        String sqluf_hotelpositions="select wxid from uf_Master_Hotel_Role where inncode="+inncodeID+" and "+Util.getSubINClause(znbscjgwStr.toString(),"hotelrole","in");//中心岗位的数据,酒店岗位的数据
        String sqluf_hotelpositions="select wxid from "+tableName+" where inncode="+inncodeID+" and "+Util.getSubINClause(znbscjgwStr.toString(),filedName,"in")+" and zt=0 order by id desc limit 0,1";//中心岗位的数据,酒店岗位的数据
        //logger1.info("sqluf_hotelpositions=====>"+sqluf_hotelpositions+"===filedName===>"+filedName);
        if(StrUtil.isNotBlank(znbscjgwStr.toString())){
            RecordSet recordSetCj=new RecordSet();
            recordSetCj.execute(sqluf_hotelpositions);
//        StringBuilder cjRHrmresouce=new StringBuilder();
            while (recordSetCj.next()){
                RecordSet recordSetPeoPle=new RecordSet();
                recordSetPeoPle.execute("select id from hrmresource where loginid='"+recordSetCj.getString("wxid")+"' and loginid <>''");
                if (recordSetPeoPle.next()){
                    cjRHrmresouce.append(recordSetPeoPle.getInt("id")).append(",");
                }
            }
        }

    }
    /**
     * 得到任务内容的英文
     * @return
     */
    public String getTilteEnglishTilte(){
        String sqlStr="select name from uf_systemconfig where uuid='task_content_english_note'";
        RecordSet recordSet=new RecordSet();
        recordSet.execute(sqlStr);
        String paramvalue="";
        if(recordSet.next()){
            paramvalue=recordSet.getString("name");
        }
        return paramvalue;
    }



    public void excuteSupporetRoleCC(StringBuilder cjRHrmresouce, Log logger1, Integer inncodeID, StringBuilder znbscjgwStr, String filedName, String tableName){
//        String sqluf_hotelpositions="select wxid from uf_Master_Hotel_Role where inncode="+inncodeID+" and "+Util.getSubINClause(znbscjgwStr.toString(),"hotelrole","in");//中心岗位的数据,酒店岗位的数据
        String sqluf_hotelpositions="select wxid from "+tableName+" where inncode="+inncodeID+" and "+Util.getSubINClause(znbscjgwStr.toString(),filedName,"in")+" and zt=0 order by id desc";//中心岗位的数据,酒店岗位的数据
        //logger1.info("sqluf_hotelpositions=====>"+sqluf_hotelpositions+"===filedName===>"+filedName);
        if(StrUtil.isNotBlank(znbscjgwStr.toString())){
            RecordSet recordSetCj=new RecordSet();
            recordSetCj.execute(sqluf_hotelpositions);
//        StringBuilder cjRHrmresouce=new StringBuilder();
            while (recordSetCj.next()){
                RecordSet recordSetPeoPle=new RecordSet();
                recordSetPeoPle.execute("select id from hrmresource where loginid='"+recordSetCj.getString("wxid")+"' and loginid <>''");
                if (recordSetPeoPle.next()){
                    cjRHrmresouce.append(recordSetPeoPle.getInt("id")).append(",");
                }
            }
        }

    }
    public  StringBuilder distainStr(StringBuilder cjRHrmresouce){
        String[] cjRHrmresouceStrTwo = cjRHrmresouce.toString().split(",");
        List<String> cjRHrmresouceStrTwoList = new ArrayList<>(Arrays.asList(cjRHrmresouceStrTwo));
        cjRHrmresouceStrTwoList=cjRHrmresouceStrTwoList.stream().filter(s->!",".equals(s)).distinct().collect(Collectors.toList());
        cjRHrmresouce=new StringBuilder(StrUtil.join(",",cjRHrmresouceStrTwoList));
        return cjRHrmresouce;
    }


    public void addDetailDataMethod(Map inncodeMapData,Log logger1,  List<String> inncodeList){
        ////logger1.info("intoThis==>addDetailDataMethod===>");

        RecordSet recordSet=new RecordSet();
        String formatTwo = DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd");
        ////logger1.info("formatTwo===>"+formatTwo);
        ////logger1.info("excueteQuerySql==>"+"select * from uf_znbsqd where modedatacreatedate='"+formatTwo);
        String findSql="select jddm,zszs,id,modedatacreatedate from uf_znbsqd where modedatacreatedate='"+formatTwo+"'";
        ////logger1.info("findSql===>"+findSql);
        recordSet.execute(findSql);
        Map<String,StringBuilder> detailCountMap=new HashMap<>();
        while (recordSet.next()){
            Integer inncodeID = recordSet.getInt("jddm");
            //致胜指数合并,
            StringBuilder zszsStr = new StringBuilder();
            //所有的raisvAlue 集合值
            zszsStr.append(recordSet.getString("zszs"));
//            Map uf_phszListMapData = getuf_phszList(inncodeList,zszsStr);//根据酒店代码找到所有的偏好设置
            ////logger1.info("inncodeID======>"+inncodeID);
//            Map ufPhMapDataMap = (Map) uf_phszListMapData.get(inncodeID+"");//获取偏好设置每一项
            ////logger1.info("ufPhMapDataMap===>"+JSONUtil.toJSONString(uf_phszListMapData));
//            if (ufPhMapDataMap!=null&&((ufPhMapDataMap.get("tbphxz") == null)|| (ufPhMapDataMap.get("tbphxz") + "").equals("-1")||(ufPhMapDataMap.get("tbphxz") + "").equals("0"))) {//创建任务没勾选的情况下,此智能部署清单不生成
//                return;
//            }


            addDetailData(recordSet.getString("id"),inncodeID,recordSet);

            reusltModulIdsLsit(inncodeMapData,zszsStr,inncodeID,logger1,recordSet.getString("id"),detailCountMap);
        }
        //deleteUpdateGfxTable();

    }
    /**
     * 找到所有的智能部署指数，对应的高风险的指数里面的ytmr如果，高风险指数对应的ytmr 大于智能部署的ytmr，
     * 代表此智能部署未发送的，是草稿的数据需要进行删除，先更新高风险表的否已发送 sfyfs=3
     * 并且删除此指数对应的未发送的这条智能部署数据和智能部署下面的两明细表数据
     * select id,gfxzsxx from uf_znbsqd where yrmonbr !=? and sfcg=0 and FIND_IN_SET(?, zszs) > 0
     * update uf_gfxzsxxgl set sfyfs=3 where id in (?)
     * update uf_gfxzsxxgl set sfyfs=3 where id in (?)
     */
    public void deleteUpdateGfxTable(){
        String sql="select id,yrmonbr as ytmr,zszs,gfxzsxx from uf_znbsqd where (sfcg=0 or sfcg is null) and sfyfs=1";
//        logger1.info("updateGfsAndDelteSql1111===>"+sql);
        RecordSet recordSet=new RecordSet();
        recordSet.execute(sql);
        //记录要更新的高风险id值
        List<List> gfxIdValueList=new ArrayList<>();
        //记录要删除的智能部署id值
        List<List> znbsqIDvaLueList=new ArrayList<>();
        while (recordSet.next()){
            //logger1.info("zszs==="+recordSet.getString("zszs"));
            String sqlTwo="select max(yrmtnbr) as yrmtnbr,id from uf_gfxzsxxgl where "+Util.getSubINClause(recordSet.getString("zszs"),"MTRX","in") +" and qrzt=1 limit 0,1";
            //logger1.info("sqlTwo===>"+sqlTwo);
            RecordSet recordSet1=new RecordSet();
            recordSet1.execute(sqlTwo);
            if (recordSet1.next()){
                String ytmr1= recordSet1.getString("yrmtnbr");
               // logger1.info("ytmr1===>"+ytmr1);
                if(!StringUtil.isEmpty(ytmr1)&&!StringUtil.isEmpty(recordSet.getString("ytmr"))){
                    if(Integer.parseInt(ytmr1)>Integer.parseInt(recordSet.getString("ytmr"))){//假如高风险表的ytmr大于智能部署的ytmr值，记录
                        List<String> znbsListItem=new ArrayList<>();
                        String []araryList=recordSet.getString("gfxzsxx").split(",");
                        List<String> gfxList= Arrays.asList(araryList).stream().filter(s -> !s.equals("")).distinct().collect(Collectors.toList());
                        for (String o : gfxList) {
                            List<String> gfxListitem=new ArrayList<>();
                            gfxListitem.add(o);
                            gfxIdValueList.add(gfxListitem);
                        }
                        znbsListItem.add(recordSet.getString("id"));
                        znbsqIDvaLueList.add(znbsListItem);
                    }
                }
            }
        }
        if(!gfxIdValueList.isEmpty()){
            RecordSet batchRecordSet=new RecordSet();
            //logger1.info("idsList===>bUpdateSfFs===>"+JSONUtil.toJSONString(idsList));
            boolean bUpdateSfFs = batchRecordSet.executeBatchSql("update uf_gfxzsxxgl set sfyfs=3 where id in (?)", gfxIdValueList);
            //logger1.info("gfxIdValueList===>bUpdateSfFs===>"+bUpdateSfFs);
            //logger1.info("gfxIdValueList=======>"+gfxIdValueList);
        }
        if(!znbsqIDvaLueList.isEmpty()){
            RecordSet batchRecordSet=new RecordSet();
            ////logger1.info("idsList===>bUpdateSfFs===>"+JSONUtil.toJSONString(idsList));
            boolean bUpdateSfFs = batchRecordSet.executeBatchSql("delete from uf_znbsqd where id in (?)", znbsqIDvaLueList);
           // logger1.info("znbsqIDvaLueList===>bUpdateSfFs===>"+bUpdateSfFs);
            boolean bUpdateSfFsTwo = batchRecordSet.executeBatchSql("delete from uf_znbsqd_dt1 where mainId in (?)", znbsqIDvaLueList);
           // logger1.info("znbsqIDvaLueList==>bUpdateSfFsTwo===>"+bUpdateSfFsTwo);
            boolean bUpdateSfFsThree = batchRecordSet.executeBatchSql("delete from uf_znbsqd_dt2 where mainId in (?)", znbsqIDvaLueList);
           // logger1.info("znbsqIDvaLueList===>bUpdateSfFsThree===>"+bUpdateSfFsThree);
            //logger1.info("znbsqIDvaLueList=======>"+znbsqIDvaLueList);
        }

    }

    /**
     * 找到所有的
     * @param recordSet
     * @param inncodeID
     * @param recordSet2
     */
    public void addDetailData( String recordSet, Integer inncodeID, RecordSet recordSet2){

        List<List> insertZhishuList=new ArrayList<>();
        if (StrUtil.isNotBlank(recordSet)) {
            RecordSet compareRecordSet = new RecordSet();
            String[] split = recordSet2.getString("zszs").split(",");
            for (String s : split) {
                String   otherYearSqlValue="select * from (SELECT main.yrmtnbr,\n" +
                        "\tYTDResult,\n" +
                        "\tYTDTRGT,\n" +
                        "\tMTDResult,\n" +
                        "\tMTDTRGT,\n" +
                        "\tINNCODE,\n" +
                        "\tqrzt,\n" +
                        "\tmain.MTRx\n" +
                        "FROM uf_DWD_Winning_Metr main\n" +
                        "INNER JOIN (\n" +
                        "    SELECT INNCODE as INNCODE1, \n" +
                        "           MTRx as MTRx1,\n" +
//                    "           MAX(left(yrmtnbr,6)) AS yrmtnbr1\n" +
                        "DATE_FORMAT(\n" +
                        "\t\tDATE_SUB(\n" +
                        "\t\t\tSTR_TO_DATE(MAX(yrmtnbr), '%Y%m%d'),\n" +
                        "\t\t\tINTERVAL 0 MONTH\n" +
                        "\t\t),\n" +
                        "\t\t'%Y%m') as yrmtnbr1,"+
                        "DATE_FORMAT(\n" +
                        "\t\tDATE_SUB(\n" +
                        "\t\t\tSTR_TO_DATE(MAX(yrmtnbr), '%Y%m%d'),\n" +
                        "\t\t\tINTERVAL 1 MONTH\n" +
                        "\t\t),\n" +
                        "\t\t'%Y%m') as yrmtnbr2,"+
                        "DATE_FORMAT(\n" +
                        "\t\tDATE_SUB(\n" +
                        "\t\t\tSTR_TO_DATE(MAX(yrmtnbr), '%Y%m%d'),\n" +
                        "\t\t\tINTERVAL 2 MONTH\n" +
                        "\t\t),\n" +
                        "\t\t'%Y%m') as yrmtnbr3"+
                        "    FROM uf_DWD_Winning_Metr\n" +
                        "    GROUP BY INNCODE, MTRX\n" +
                        ") tmp \n" +
                        "ON main.INNCODE = tmp.INNCODE1 \n" +
                        "   AND main.MTRX = tmp.MTRX1 \n" +
                        "   AND (left(main.yrmtnbr,6)  = tmp.yrmtnbr1  or left(main.yrmtnbr,6)  = tmp.yrmtnbr2 or left(main.yrmtnbr,6)  = tmp.yrmtnbr3))A where "+"  find_in_set("+s+",A.MTRX)"+  " and A.qrzt=1 and A.INNCODE=" + inncodeID +" order by A.MTRX";
                //logger1.info("otherYeaerSqlValue===>"+otherYearSqlValue+"====>recordSetId===>"+recordSet);
                compareRecordSet.execute(otherYearSqlValue);
                while (compareRecordSet.next()){
                    List<Object> paramListObj = new ArrayList<>();
                    //假如在三个月内
                        paramListObj.add(compareRecordSet.getString("yrmtnbr") + "");
                        paramListObj.add(StringUtil.isEmpty(compareRecordSet.getString("MTRX"))?"0":compareRecordSet.getString("MTRX"));//指数名称
                        paramListObj.add(StringUtil.isEmpty(compareRecordSet.getString("YTDResult"))?null:compareRecordSet.getString("YTDResult"));//年度结果
                        paramListObj.add(StringUtil.isEmpty(compareRecordSet.getString("YTDTRGT"))?null:compareRecordSet.getString("YTDTRGT")  );//年度目标
                        paramListObj.add(StringUtil.isEmpty(compareRecordSet.getString("MTDResult"))?null:compareRecordSet.getString("MTDResult") );//月度结果
                        paramListObj.add(StringUtil.isEmpty(compareRecordSet.getString("MTDTRGT"))?null:compareRecordSet.getString("MTDTRGT") );//月度目标
                        paramListObj.add(recordSet2.getString("id"));//mianID主表id值
                        insertZhishuList.add(paramListObj);

                    //logger1.info("mainid====>=====>"+recordSet+"========>" +"====>paramListObj===>"+paramListObj);
                }
            }
            insertZhishuList=insertZhishuList.stream().distinct().collect(Collectors.toList());
            //logger1.info("insertZhishuList===>"+JSONUtil.toJSONString(insertZhishuList)+"====.mainid====>"+recordSet);
            if(!insertZhishuList.isEmpty()&&recordSet!=null&&!recordSet.equals("")){
                String insertZhishuSignleSql="insert into uf_znbsqd_dt1 (yrmtnbr,zsmc,ndjg,ndmb,ydjg,ydmb,mainId) values (?,?,?,?,?,?,?)";
                boolean b1= new RecordSet().executeBatchSql(insertZhishuSignleSql, insertZhishuList);
                ////logger1.info("b1===>"+b1);
            }

//            and find_in_set("+r+",zszs)

//            List<List> studentsSortName = insertZhishuList.stream().sorted(Comparator.comparing(StudentInfo::getAge)).collect(Collectors.toList());


        }


    }

    public void addCanshListDetailData(String recordSet,Integer inncodeID,List<List> insertCanshList,String csmcId){

        if (StrUtil.isNotBlank(recordSet)) {
            String yearSqlValue = "SELECT *\n" +
                    "FROM uf_DWD_Smart_Deployment_Reference main\n" +
                    "INNER JOIN (\n" +
                    "    SELECT INNCODE as INNCODE1, \n" +
                    "           csmc as csmc1,\n" +
                    "DATE_FORMAT(\n" +
                    "\t\tDATE_SUB(\n" +
                    "\t\t\tSTR_TO_DATE(MAX(yrmtnbr), '%Y%m%d'),\n" +
                    "\t\t\tINTERVAL 0 MONTH\n" +
                    "\t\t),\n" +
                    "\t\t'%Y%m') as yrmtnbr1"+
                    "    FROM uf_DWD_Smart_Deployment_Reference\n" +
                    "    GROUP BY INNCODE, csmc\n" +
                    ") tmp \n" +
                    "ON main.INNCODE = tmp.INNCODE1 \n" +
                    "   AND main.csmc = tmp.csmc1 \n" +
                    "   AND left(main.yrmtnbr,6)  = tmp.yrmtnbr1 where  INNCODE="+inncodeID+" and qrzt=1 and main.csmc="+csmcId+" order by id desc";//            String yearSqlValue = "SELECT *\n" +
//                    "FROM uf_DWD_Smart_Deployment_Reference main\n" +
//                    "INNER JOIN (\n" +
//                    "    SELECT INNCODE as INNCODE1, \n" +
//                    "           csmc as csmc1,\n" +
//                    "           MAX(left(yrmtnbr,6)) AS yrmtnbr1\n" +
//                    "    FROM uf_DWD_Smart_Deployment_Reference\n" +
//                    "    GROUP BY INNCODE, csmc\n" +
//                    ") tmp \n" +
//                    "ON main.INNCODE = tmp.INNCODE1 \n" +
//                    "   AND main.csmc = tmp.csmc1 \n" +
//                    "   AND left(main.yrmtnbr,6)  = tmp.yrmtnbr1 where  INNCODE="+inncodeID+" and qrzt=1 order by id desc";
            RecordSet compareRecordSet = new RecordSet();
            //logger1.info("canshSqlSearch====>"+yearSqlValue+"====>recordSet===>"+recordSet);
            compareRecordSet.execute(yearSqlValue);
            while (compareRecordSet.next() ) {

                List<Object> paramListObjTwo = new ArrayList<>();

                //假如在1个月内
                ////logger1.info("intoTHis====TIme2222222====>");
//                                    insert into uf_znbsqd_dt2 (csmc,yrmtnbr,ndjg,ndmb,ydjg,ydmb,mainId) values (?,?,?,?,?,?,?)
//                        recoresetTwo11.execute(sqltwoStr);
                paramListObjTwo.add(compareRecordSet.getInt("csmc")+"");//参数名称
                paramListObjTwo.add(compareRecordSet.getInt("yrmtnbr")+"");
                paramListObjTwo.add(StrUtil.isEmpty(compareRecordSet.getString("ndjg"))?null:compareRecordSet.getString("ndjg"));//年度结果
                paramListObjTwo.add(StrUtil.isEmpty(compareRecordSet.getString("ndmb"))?null:compareRecordSet.getString("ndmb"));//年度目标
                paramListObjTwo.add(StrUtil.isEmpty(compareRecordSet.getString("ydjg"))?null:compareRecordSet.getString("ydjg"));//月度结果
                paramListObjTwo.add(StrUtil.isEmpty(compareRecordSet.getString("ydmb"))?null:compareRecordSet.getString("ydmb"));//月度目标
                paramListObjTwo.add(recordSet);//mianID主表id值
                insertCanshList.add(paramListObjTwo);


            }
        }

    }
    public String getAllIdsList(Map<String, Object> innCodeMapArgs){
        String sql="select min(id) as id,brand from uf_hotelinfo where brand is not null and brand='"+innCodeMapArgs.get("brand")+"' group by brand";
        ////logger1.info("getAllIdsListsql===>"+sql);
        RecordSet recordSet=new RecordSet();
        recordSet.execute(sql);
        if(recordSet.next()){
            return  recordSet.getString("id");
        }else {
            return "";
        }

    }
    public String getAllDqIdsList(Map<String, Object> innCodeMapArgs){
        String sql="select min(id) as id,region from uf_hotelinfo where region is not null and region='"+(StrUtil.isBlank(innCodeMapArgs.get("region")+"")?"":innCodeMapArgs.get("region")+"".replace("a",""))+"' group by region";
        ////logger1.info("getAllIdsListsql===>"+sql);
        RecordSet recordSet=new RecordSet();
        recordSet.execute(sql);
        if(recordSet.next()){
            if(recordSet.getString("rgion").equalsIgnoreCase("GC")){
                return  recordSet.getString("id")+"b";
            }
            return  recordSet.getString("id")+"a";
        }else {
            return "";
        }

    }

    public String getAllDqIdsListTwo(Map<String, Object> innCodeMapArgs){
        String sql="select min(id) as id,region from uf_hotelinfo where region is not null and region='"+(StrUtil.isBlank(innCodeMapArgs.get("region")+"")?"":innCodeMapArgs.get("region")+"".replace("a",""))+"' group by region";
        ////logger1.info("getAllIdsListsql===>"+sql);
        RecordSet recordSet=new RecordSet();
        recordSet.execute(sql);
        if(recordSet.next()){
            return  recordSet.getString("id");
        }else {
            return "";
        }

    }
    /**
     * 获取所有的品牌对应的ids集合
     * @param idsList
     * @return
     */
    public List<String> getALlNameString(List<String> idsList){
        List<String> nameList=new ArrayList<>();
        RecordSet recordSet=new RecordSet();
        if(idsList!=null&&idsList.size()>0){
            String sql="select min(id) as id,region from uf_hotelinfo where region is not null and "+Util.getSubINClause(StrUtil.join(",",idsList),"region","in")+" group by region";
            recordSet.execute(sql);
            while (recordSet.next()){
                nameList.add(recordSet.getString("region"));
            }
        }
        return nameList;
    }
    /**
     * 2、通过【匹配原则】:and/or 判断明细表中参数逻辑2.1
     *  and:明细表中数据有一条不满足 即可取当前模板;--明细数据全部满足,，
     *  则取2.2
     *  or:明细表中数据全部不满足，即可取当前模板----明细数据有一条满足，则取
     * @param inncodeMapData
     * @param zszsStr
     * @param inncodeID
     * @param baseBean
     * @param recordSet
     * @param gzkMap
     * @return
     */
    public Map<String,Object> reusltModulIdsLsit(Map inncodeMapData,StringBuilder zszsStr,Integer inncodeID,Log baseBean,String recordSet,Map<String,StringBuilder> gzkMap){
//        List<Map<String,Map<String,Object>>> rwTagList=new ArrayList<>();//任务替换内容标签集合
        //根据酒店代码找到相应的大区。
        List<String> reusltModulIds = new ArrayList<>();
        Map<String,Object> map=new HashMap<>();
        //根据酒店代码找到所有酒店信息的，大区，品牌，管理模式
        // 指数+大区+品牌+管理模式 找指数库规则表
        RecordSet zhishuRecordSet = new RecordSet();

        Map<String, Object> innCodeMapArgs =  inncodeMapData.get(inncodeID + "")==null?new HashMap<>():(Map<String, Object>) inncodeMapData.get(inncodeID + "");
//        ////logger1.info("innCodeMapArgs===>"+JSONUtil.toJSONString(innCodeMapArgs));
        String printZhishuRecoreSetKuSqlINfo="select * from uf_zsk where "+Util.getSubINClause(StrUtil.join(",",Arrays.asList(zszsStr.toString().split(","))),"zs","in")+
                " and relationship like '%"+innCodeMapArgs.get("relationship")+"%' and brand like '%"+getAllIdsList(innCodeMapArgs)+"%' and ( find_in_set ('"+getAllDqIdsListTwo(innCodeMapArgs)+"a',region)"+" or  region like '%GC%'  or region like '%b')";
        //logger1.info("recordSet!=null"+recordSet+"===>printZhishuRecoreSetKuSqlINfo=====>"+printZhishuRecoreSetKuSqlINfo);
        zhishuRecordSet.execute(printZhishuRecoreSetKuSqlINfo);
        String insertZhishuTwoSql="insert into uf_znbsqd_dt2 (csmc,yrmtnbr,ndjg,ndmb,ydjg,ydmb,mainId) values (?,?,?,?,?,?,?)";

        List<List> insertCanshList=new ArrayList<>();
        //yrmtnbr YR_MT_NBR 单行文本框 文本 文本长度:999
        //zsmc 指数名称 浏览按钮 自定义单选 browser.zszs
        //ndjg 年度结果 单行文本框 浮点数 小数点位数:2
        ////logger1.info("zszsStr.toString()====>"+zszsStr.toString());
        List<String> zsIdsListName = new ArrayList<>(Arrays.asList(zszsStr.toString().split(",")));
        Map<String,String> dyZshListMap=new HashMap<>();
        ////logger1.info("zsIdListName===>"+JSONUtil.toJSONString(zsIdsListName));
        // csmc 参数名称 浏览按钮 自定义单选 browser.select_paramet
        //yrmtnbr YR_MT_NBR 单行文本框 文本 文本长度:999
        //ndyd 年度/月度 选择框-下拉框 年度,月度
        //csjgz 参数结果值 单行文本框 浮点数 浮点数 小数点位数:2er
        Integer mainId=null;
        StringBuilder gzkStringBUlider=new StringBuilder();
//        addDetailData(logger1,recordSet,inncodeID,insertZhishuList,zszsStr);
        Map<String,List<String>> itemZsDyModuId=new HashMap<>();
        while (zhishuRecordSet.next()) {
            //匹配原则
            int ppgz = zhishuRecordSet.getInt("ppgz");//0=and ,1=or
            //根据指数找到所有，年度月度值。
            String detailsSql = "select * from uf_zsk_dt1 where mainId=?";
            ////logger1.info("recordSet!=null"+recordSet+"===>+detailsSql===>" + detailsSql + "===>mainId==>" + zhishuRecordSet.getInt("id"));
            mainId=zhishuRecordSet.getInt("id");
            gzkStringBUlider.append(mainId).append(",");
            RecordSet recordSetDetail = new RecordSet();
            recordSetDetail.executeQuery(detailsSql, zhishuRecordSet.getInt("id"));
            List<String> dyMbIdsList=new ArrayList<>();
            //若这个规则明细中的 某一个指标  的 年度结果值/月度结果值  为 空  认为这条数据不满足
            int andInt = 0;//and 的时候下面有任意一不符合就=true;
            int orInt=0;//只要找到一个符合的那便是1,所有都不符合变成2，才要取
            while (recordSetDetail.next()) {
                if(andInt==2){
                    andInt=0;
                }
                String yearSqlValue = "select * from uf_DWD_Winning_Metr where MTRX=" + zhishuRecordSet.getInt("zs");//找到指数管理表中的数据要被比较的值
                String sqlStr = "select lx,ids from uf_zbmc where ids = '"+recordSetDetail.getString("cs")+"'";//lx=0参数，1指数
                //logger1.info("sqlStr222===>" + sqlStr+"===>recordSetIsNull==>"+(StrUtil.isNotBlank(recordSet)));
                RecordSet recordSetDetailSql = new RecordSet();
                recordSetDetailSql.execute(sqlStr);
                int lxFirst = 3;
                if (recordSetDetailSql.next()) {
                    int lxTwo = recordSetDetailSql.getInt("lx");
                    lxFirst = lxTwo;
                    if (lxTwo == 1) {
                        yearSqlValue = "SELECT main.yrmtnbr,\n" +
                                "\tYTDResult,\n" +
                                "\tYTDTRGT,\n" +
                                "\tMTDResult,\n" +
                                "\tMTDTRGT,\n" +
                                "\tINNCODE,\n" +
                                "\tqrzt,\n" +
                                "\tmain.MTRx\n" +
                                "FROM uf_DWD_Winning_Metr main\n" +
                                "INNER JOIN (\n" +
                                "    SELECT INNCODE as INNCODE1, \n" +
                                "           MTRx as MTRx1,\n" +
                                "DATE_FORMAT(\n" +
                                "\t\tDATE_SUB(\n" +
                                "\t\t\tSTR_TO_DATE(MAX(yrmtnbr), '%Y%m%d'),\n" +
                                "\t\t\tINTERVAL 0 MONTH\n" +
                                "\t\t),\n" +
                                "\t\t'%Y%m') as yrmtnbr1"+
                                "    FROM uf_DWD_Winning_Metr\n" +
                                "    GROUP BY INNCODE, MTRX\n" +
                                ") tmp \n" +
                                "ON main.INNCODE = tmp.INNCODE1 \n" +
                                "   AND main.MTRX = tmp.MTRX1 \n" +
                                "   AND left(main.yrmtnbr,6)  = tmp.yrmtnbr1 where MTRX='" + recordSetDetailSql.getString("ids").replace("zs","")+"' and qrzt=1 and INNCODE="+inncodeID +" order by id desc limit 0,1";
                        //logger1.info("lxTwo11111111===>"+lxTwo+"===>yearSqlValue-=====>"+yearSqlValue);
                    } else if (lxTwo == 0) {

                        //找到主表上的最大yrmtnbr =这个致胜指数的

                        String maxZhishuSql="SELECT left(main.yrmtnbr,6) as yrmtnbr,\n" +
                                "\tqrzt,\n" +
                                "\tmain.MTRx\n" +
                                "FROM uf_DWD_Winning_Metr main\n" +
                                "INNER JOIN (\n" +
                                "    SELECT INNCODE as INNCODE1, \n" +
                                "           MTRx as MTRx1,\n" +
                                "DATE_FORMAT(\n" +
                                "\t\tDATE_SUB(\n" +
                                "\t\t\tSTR_TO_DATE(MAX(yrmtnbr), '%Y%m%d'),\n" +
                                "\t\t\tINTERVAL 0 MONTH\n" +
                                "\t\t),\n" +
                                "\t\t'%Y%m') as yrmtnbr1"+
                                "    FROM uf_DWD_Winning_Metr\n" +
                                "    GROUP BY INNCODE, MTRX\n" +
                                ") tmp \n" +
                                "ON main.INNCODE = tmp.INNCODE1 \n" +
                                "   AND main.MTRX = tmp.MTRX1 \n" +
                                "   AND left(main.yrmtnbr,6)  = tmp.yrmtnbr1 where MTRX=" + zhishuRecordSet.getInt("zs")+" and qrzt=1 and INNCODE="+inncodeID +" order by id desc limit 0,1";
                        RecordSet recordSet1=new RecordSet();
                        String ytmrMaxZhishu="";recordSet1.execute(maxZhishuSql);
                        if(recordSet1.next()){
                            ytmrMaxZhishu=recordSet1.getString("yrmtnbr");
                        }
                        yearSqlValue = "SELECT *\n" +
                                "FROM uf_DWD_Smart_Deployment_Reference main\n" +
                                "  where left(main.yrmtnbr,6)  ='"+ytmrMaxZhishu+"' and csmc='" + recordSetDetailSql.getString("ids").replace("cs","")+"' and INNCODE="+inncodeID+" order by id desc limit 0,1";
//                                +" and qrzt=1 and yrmtnbr like '"+DateUtil.format(LocalDateTime.now().plusMonths(-1), "yyyyMM")+"%'" +" order by id desc limit 0,1";//找到指数参数表中的数据要被比较的值;
                        //logger1.info("lxTwoElse===>"+lxTwo+"===>yearSqlValue-=====>"+yearSqlValue+"===>yrmtnbr===>"+ytmrMaxZhishu);
                    }
                }
                //logger1.info("yearSqlValue===>" + yearSqlValue);
                RecordSet compareRecordSet = new RecordSet();
                compareRecordSet.execute(yearSqlValue);
                int ndyd = recordSetDetail.getInt("ndyd");//年度=0,1=月度；

                int lx = recordSetDetail.getInt("lx");//年度目标值=0,年度阈值=1,月度目标值=2,月度阈值=3,4=1;5=上年度目标值,6=上月度目标值//类型
                int gz = recordSetDetail.getInt("gz");//0=>1,1=<2,2==0, 0==,1>,2<
                String jsgs = recordSetDetail.getString("jsgs");//计算公式
                //logger1.info("ndyd===>"+ndyd+"==>gz===>"+gz+"===>jsgs===>"+jsgs+"===>lx===>"+lx);
                double z = recordSetDetail.getString("z") == null || recordSetDetail.getString("z").equals("") ? 0 : Double.parseDouble(recordSetDetail.getString("z"));//值
                //logger1.info("z===>"+z);
                //找到参数里面的月度阀值和
                double compareValue=0;

                double yearOverValue = 0;
                if(compareRecordSet.next()&&lxFirst!=3){

                    if(lxFirst==0){
                        addCanshListDetailData(recordSet,inncodeID,insertCanshList, recordSetDetailSql.getString("ids").replace("cs",""));
                    }




                    ////logger1.info("compareSetNext===>intoThis===>"+"===>lxFirst===>"+lxFirst+"====ndyd===>"+ndyd+"====>lx========>"+lx);
                    if(ndyd==0){
                        if (lxFirst == 1) {//指数
                            //logger1.info("intho1===>222===>ytdResult===>");
                            //logger1.info("====>value11111=>"+compareRecordSet.getString("YTDResult"));
                            if(compareRecordSet.getString("YTDResult")==null||("").equals(compareRecordSet.getString("YTDResult"))){
                                continue;
                            }
                            compareValue = Double.valueOf(compareRecordSet.getString("YTDResult")==null||"".equals(compareRecordSet.getString("YTDResult"))?"0":compareRecordSet.getString("YTDResult"));//年度结果

                        }else if(lxFirst==0){
                            if(compareRecordSet.getString("ndjg")==null||("").equals(compareRecordSet.getString("ndjg"))){
                                continue;
                            }

                            compareValue = Double.valueOf(compareRecordSet.getString("ndjg")==null||"".equals(compareRecordSet.getString("ndjg"))?"0":compareRecordSet.getString("ndjg"));//年度结果

                        }

                    }else if(ndyd==1){
                        if (lxFirst == 1) {//指数
                            if(compareRecordSet.getString("MTDResult")==null||("").equals(compareRecordSet.getString("MTDResult"))){
                                continue;
                            }

                            compareValue = Double.valueOf(compareRecordSet.getString("MTDResult")==null||"".equals(compareRecordSet.getString("MTDResult"))?"-10":compareRecordSet.getString("MTDResult"));//月度结果


                        } else {
                            if(compareRecordSet.getString("ydjg")==null||("").equals(compareRecordSet.getString("ydjg"))){
                                continue;
                            }
                            compareValue = Double.valueOf(compareRecordSet.getString("ydjg")==null||"".equals(compareRecordSet.getString("ydjg"))?"0":compareRecordSet.getString("ydjg"));//月度结果


                        }
                    }
                    //logger1.info("compareValue===>"+compareValue);
                    if (lx == 0) {//年度目标值=0,年度阈值=1,月度目标值=2,月度阈值=3,4=1;//类型
                        if (lxFirst == 1) {//指数
                            //logger1.info("lxFirst===>"+lxFirst+"====>");
                            yearOverValue = Double.valueOf(compareRecordSet.getString("YTDTRGT")==null||"".equals(compareRecordSet.getString("YTDTRGT"))?"0":compareRecordSet.getString("YTDTRGT"));//年度目标值
                        } else {
                            yearOverValue = Double.parseDouble(compareRecordSet.getString("ndmb")==null||"".equals(compareRecordSet.getString("ndmb"))?"0":compareRecordSet.getString("ndmb"));//年度目标值

                        }

                    } else if (lx == 1) {//年度目标值=0,年度阈值=1,月度目标值=2,月度阈值=3,4=1;//类型
                        if (lxFirst == 1) {//指数
                            yearOverValue = Double.valueOf(compareRecordSet.getString("YTDResult")==null||"".equals(compareRecordSet.getString("YTDResult"))?"0":compareRecordSet.getString("YTDResult"));//年度阈值,暂时放年度结果



                        } else {

                            yearOverValue = Double.valueOf(compareRecordSet.getString("ndyz")==null||"".equals(compareRecordSet.getString("ndyz"))?"0":compareRecordSet.getString("ndyz"));//年度阀值

                        }
                    } else if (lx == 2) {
                        if (lxFirst == 1) {//指数


                            yearOverValue = Double.valueOf(compareRecordSet.getString("MTDTRGT")==null||"".equals(compareRecordSet.getString("MTDTRGT"))?"0":compareRecordSet.getString("MTDTRGT"));//月度目标


                        } else {

                            yearOverValue = Double.valueOf(compareRecordSet.getString("ydmb")==null||"".equals(compareRecordSet.getString("ydmb"))?"0":compareRecordSet.getString("ydmb"));//月度目标

                        }
                    } else if (lx == 3) {
                        if (lxFirst == 1) {//指数

                            yearOverValue = Double.valueOf(compareRecordSet.getString("MTDResult")==null||"".equals(compareRecordSet.getString("MTDResult"))?"0":compareRecordSet.getString("MTDResult"));//月度阈值，暂时放月度结果


                        } else {


                            yearOverValue = Double.valueOf(compareRecordSet.getString("ydyz")==null||"".equals(compareRecordSet.getString("ydyz"))?"0":compareRecordSet.getString("ydyz"));//月度阈值


                        }
                    } else if (lx == 4) {
                        //logger1.info("lx====4=====>111");
                        yearOverValue = 1;
                    }else if(lx==5){//上年度目标值
                        String   otheryearSqlValue ="";
                        if (lxFirst == 1) {
                            otheryearSqlValue="SELECT main.yrmtnbr,\n" +
                                    "\tYTDResult,\n" +
                                    "\tYTDTRGT,\n" +
                                    "\tMTDResult,\n" +
                                    "\tINNCODE,\n" +
                                    "\tMTDTRGT,\n" +
                                    "\tqrzt,\n" +
                                    "\tmain.MTRx\n" +
                                    "FROM uf_DWD_Winning_Metr main\n" +
                                    "INNER JOIN (\n" +
                                    "    SELECT INNCODE as INNCODE1, \n" +
                                    "           MTRx as MTRx1,\n" +
                                    "DATE_FORMAT(\n" +
                                    "\t\tDATE_SUB(\n" +
                                    "\t\t\tSTR_TO_DATE(MAX(yrmtnbr), '%Y%m%d'),\n" +
                                    "\t\t\tINTERVAL 1 YEAR\n" +
                                    "\t\t),\n" +
                                    "\t\t'%Y%m') as yrmtnbr1"+
                                    "    FROM uf_DWD_Winning_Metr\n" +
                                    "    GROUP BY INNCODE, MTRX\n" +
                                    ") tmp \n" +
                                    "ON main.INNCODE = tmp.INNCODE1 \n" +
                                    "   AND main.MTRX = tmp.MTRX1 \n" +
                                    "   AND left(main.yrmtnbr,6)  = tmp.yrmtnbr1 where MTRX='" + recordSetDetailSql.getString("ids").replace("zs","")+"' and qrzt=1 and INNCODE="+inncodeID +" order by id desc limit 0,1";
                        } else if (lxFirst == 0) {
                            otheryearSqlValue = "SELECT *\n" +
                                    "FROM uf_DWD_Smart_Deployment_Reference main\n" +
                                    "INNER JOIN (\n" +
                                    "    SELECT INNCODE as INNCODE1, \n" +
                                    "           csmc as csmc1,\n" +
                                    "DATE_FORMAT(\n" +
                                    "\t\tDATE_SUB(\n" +
                                    "\t\t\tSTR_TO_DATE(MAX(yrmtnbr), '%Y%m%d'),\n" +
                                    "\t\t\tINTERVAL 1 YEAR\n" +
                                    "\t\t),\n" +
                                    "\t\t'%Y%m') as yrmtnbr1"+
                                    "    FROM uf_DWD_Smart_Deployment_Reference\n" +
                                    "    GROUP BY INNCODE, csmc\n" +
                                    ") tmp \n" +
                                    "ON main.INNCODE = tmp.INNCODE1 \n" +
                                    "   AND main.csmc = tmp.csmc1 \n" +
                                    "   AND left(main.yrmtnbr,6)  = tmp.yrmtnbr1 where csmc='" + recordSetDetailSql.getString("ids").replace("cs","")+"' and INNCODE="+inncodeID+" and qrzt=1 order by id desc limit 0,1";
                        }
                        //logger1.info("otherYearSqlValue==>"+otheryearSqlValue);
                        RecordSet recordSet1=new RecordSet();
                        recordSet1.execute(otheryearSqlValue);
                        if (recordSet1.next()){
                            if (lxFirst == 1) {//指数
                                //logger1.info("otheryearSqlValue====>yearOverValueYTDResult====>"+compareRecordSet.getString("YTDResult"));
//                                compareValue = Double.valueOf(compareRecordSet.getString("YTDResult"));//上年度目标值===>年度目标值
                                yearOverValue = Double.valueOf(compareRecordSet.getString("YTDResult")==null||"".equals(compareRecordSet.getString("YTDResult"))?"0":compareRecordSet.getString("YTDResult"));//月度阈值，暂时放月度结果


                            } else {
                                //logger1.info("otheryearSqlValue====>yearOverValuendjg====>"+compareRecordSet.getString("ndjg"));
//                                compareValue = Double.valueOf(compareRecordSet.getString("ndjg"));//年度目标值  需要取年度目标值
                                yearOverValue = Double.valueOf(compareRecordSet.getString("ndjg")==null||"".equals(compareRecordSet.getString("ndjg"))?"0":compareRecordSet.getString("ndjg"));//月度阈值，暂时放月度结果


                            }
                        }
                        //logger1.info("otherYearSqlValue===>Value111===>"+yearOverValue);

                    }else if(lx==6){//上月度目标值
                        String   otheryearSqlValue ="";
                        if (lxFirst == 1) {
                            otheryearSqlValue="SELECT main.yrmtnbr,\n" +
                                    "\tYTDResult,\n" +
                                    "\tYTDTRGT,\n" +
                                    "\tMTDResult,\n" +
                                    "\tMTDTRGT,\n" +
                                    "\tINNCODE,\n" +
                                    "\tqrzt,\n" +
                                    "\tmain.MTRx\n" +
                                    "FROM uf_DWD_Winning_Metr main\n" +
                                    "INNER JOIN (\n" +
                                    "    SELECT INNCODE as INNCODE1, \n" +
                                    "           MTRx as MTRx1,\n" +
                                    "DATE_FORMAT(\n" +
                                    "\t\tDATE_SUB(\n" +
                                    "\t\t\tSTR_TO_DATE(MAX(yrmtnbr), '%Y%m%d'),\n" +
                                    "\t\t\tINTERVAL 1 MONTH\n" +
                                    "\t\t),\n" +
                                    "\t\t'%Y%m') as yrmtnbr1"+
                                    "    FROM uf_DWD_Winning_Metr\n" +
                                    "    GROUP BY INNCODE, MTRX\n" +
                                    ") tmp \n" +
                                    "ON main.INNCODE = tmp.INNCODE1 \n" +
                                    "   AND main.MTRX = tmp.MTRx1 \n" +
                                    "   AND left(main.yrmtnbr,6)  = tmp.yrmtnbr1 where MTRX='" + recordSetDetailSql.getString("ids").replace("zs","")+"' and qrzt=1 and INNCODE="+inncodeID +" order by id desc limit 0,1";
                            //+" and yrmtnbr like '"+DateUtil.format(LocalDateTime.now().plusMonths(-2), "yyyyMM")+"%'" +" order by id desc limit 0,1";//找到指数管理表中的数据要被比较的值;
                        } else if (lxFirst == 0) {


                            //找到主表上的最大yrmtnbr =这个致胜指数的

                            String maxZhishuSql="SELECT left(main.yrmtnbr,6) as yrmtnbr,\n" +
                                    "\tqrzt,\n" +
                                    "\tmain.MTRx\n" +
                                    "FROM uf_DWD_Winning_Metr main\n" +
                                    "INNER JOIN (\n" +
                                    "    SELECT INNCODE as INNCODE1, \n" +
                                    "           MTRx as MTRx1,\n" +
                                    "DATE_FORMAT(\n" +
                                    "\t\tDATE_SUB(\n" +
                                    "\t\t\tSTR_TO_DATE(MAX(yrmtnbr), '%Y%m%d'),\n" +
                                    "\t\t\tINTERVAL 0 MONTH\n" +
                                    "\t\t),\n" +
                                    "\t\t'%Y%m') as yrmtnbr1"+
                                    "    FROM uf_DWD_Winning_Metr\n" +
                                    "    GROUP BY INNCODE, MTRX\n" +
                                    ") tmp \n" +
                                    "ON main.INNCODE = tmp.INNCODE1 \n" +
                                    "   AND main.MTRX = tmp.MTRX1 \n" +
                                    "   AND left(main.yrmtnbr,6)  = tmp.yrmtnbr1 where MTRX=" + zhishuRecordSet.getInt("zs")+" and qrzt=1 and INNCODE="+inncodeID +" order by id desc limit 0,1";
                            RecordSet recordSet1=new RecordSet();
                            String ytmrMaxZhishu="";recordSet1.execute(maxZhishuSql);
                            if(recordSet1.next()){
                                ytmrMaxZhishu=recordSet1.getString("yrmtnbr");
                            }
                            otheryearSqlValue = "SELECT *\n" +
                                    "FROM uf_DWD_Smart_Deployment_Reference main\n" +
                                    "  where left(main.yrmtnbr,6)  ='"+ytmrMaxZhishu+"' and csmc='" + recordSetDetailSql.getString("ids").replace("cs","")+"' and INNCODE="+inncodeID+" order by id desc limit 0,1";
//                            otheryearSqlValue = "SELECT *\n" +
//                                    "FROM uf_DWD_Smart_Deployment_Reference main\n" +
//                                    "INNER JOIN (\n" +
//                                    "    SELECT INNCODE as INNCODE1, \n" +
//                                    "           csmc as csmc1,\n" +
//                                    "DATE_FORMAT(\n" +
//                                    "\t\tDATE_SUB(\n" +
//                                    "\t\t\tSTR_TO_DATE(MAX(yrmtnbr), '%Y%m%d'),\n" +
//                                    "\t\t\tINTERVAL 1 MONTH\n" +
//                                    "\t\t),\n" +
//                                    "\t\t'%Y%m') as yrmtnbr1"+
//                                    "    FROM uf_DWD_Smart_Deployment_Reference\n" +
//                                    "    GROUP BY INNCODE, csmc\n" +
//                                    ") tmp \n" +
//                                    "ON main.INNCODE = tmp.INNCODE1 \n" +
//                                    "   AND main.csmc = tmp.csmc1 \n" +
//                                    "   AND left(main.yrmtnbr,6)  = tmp.yrmtnbr1 where csmc='" + recordSetDetailSql.getString("ids").replace("cs","")+"' and INNCODE="+inncodeID+" and qrzt=1 " +" order by id desc limit 0,1";
//                                    "and yrmtnbr like '"+DateUtil.format(LocalDateTime.now().plusMonths(-2), "yyyyMM")+"%'" +" order by main.id desc limit 0,1";//找到指数参数表中的数据要被比较的值;
                        }
                        //logger1.info("otherYearSqlValue22222222==>"+otheryearSqlValue);
                        RecordSet recordSet1=new RecordSet();
                        recordSet1.execute(otheryearSqlValue);
                        if (recordSet1.next()){
                            if (lxFirst == 1) {//指数
                                //logger1.info("otherYearSqlValue222222222222MTDResult==>"+compareRecordSet.getString("MTDResult"));
                                yearOverValue = Double.valueOf(compareRecordSet.getString("MTDResult"));//上月度目标值===>月度结果值

                            } else {
                                //logger1.info("otherYearSqlValueydjg==>"+compareRecordSet.getString("ydjg"));
                                yearOverValue = Double.valueOf(compareRecordSet.getString("ydjg"));//月度目标值===>月度结果值

                            }
                        }
                    }

                    if(andInt!=1){
                        switch (gz) {//0=>1,1=<2,2==0, 0==,1>,2<
                            case 2:
                                if (compareValue >= yearOverValue * z) {
                                    andInt = 1;
                                }else {
                                    andInt=2;
                                }
                                break;
                            case 0:
                                if (compareValue != yearOverValue * z) {
                                    andInt = 1;
                                }else {
                                    andInt=2;
                                }
                                break;
                            case 1:
                                if (compareValue <= yearOverValue * z) {
                                    andInt = 1;
                                }else {
                                    andInt=2;
                                }
                                break;
                            default:
                                break;
                        }
                    }




                    if (orInt != 1) {
                        switch (gz) {//0=>1,1=<2,2==0, 0==,1>,2<
                            case 2:
                                if (compareValue < yearOverValue * z) {
                                    orInt = 1;
                                } else {
                                    orInt = 2;
                                }
                                break;
                            case 0:
                                if (compareValue == yearOverValue * z) {
                                    orInt = 1;
                                }else {
                                    orInt = 2;
                                }
                                break;
                            case 1:
                                if (compareValue > yearOverValue * z) {
                                    orInt = 1;
                                } else {
                                    orInt = 2;
                                }
                                break;
                            default:
                                break;
                        }

                    }
                }

                //logger1.info("gzkDetailId==>"+recordSetDetail.getString("id")+"==>gz1111====>" + gz + "======>yearOverValue1111111===>" + yearOverValue+"===>andJudege===>"+andInt+"===>ppgz===>"+ppgz+"===>orJudge===>"+orInt);




            }
            if (andInt==2 && ppgz == 0) {
                if(!(zhishuRecordSet.getInt("mb")+"").equals("-1")){

                    reusltModulIds.add(zhishuRecordSet.getInt("mb") + "");
                }
                //logger1.info("andInt==2==zsIdsListName========>"+JSONUtil.toJSONString(zsIdsListName)+"=========>zsValue===>"+zhishuRecordSet.getString("zs"));
                if(zsIdsListName.lastIndexOf(zhishuRecordSet.getString("zs"))!=-1){
                    //logger1.info("andInt===2===>zsIdsListValue====>"+zsIdsListName.lastIndexOf(zhishuRecordSet.getString("zs")));
                    zsIdsListName.set(zsIdsListName.lastIndexOf(zhishuRecordSet.getString("zs")),zhishuRecordSet.getString("zs"));
                    if(!(zhishuRecordSet.getInt("mb")+"").equals("-1")){
                        dyZshListMap.put(zhishuRecordSet.getInt("mb") +"",zhishuRecordSet.getString("zs"));
                        dyMbIdsList.add(zhishuRecordSet.getInt("mb") +"");
                    }

                    if(itemZsDyModuId.containsKey(zhishuRecordSet.getString("zs"))){
                        List<String> oraginList=itemZsDyModuId.get(zhishuRecordSet.getString("zs"));
                        oraginList.add(zhishuRecordSet.getInt("mb") +"");
                        itemZsDyModuId.put(zhishuRecordSet.getString("zs"),oraginList);
                    }else {
                        itemZsDyModuId.put(zhishuRecordSet.getString("zs"),dyMbIdsList);
                    }
                }
            }
            if (orInt==1 && ppgz == 1) {
                if(!(zhishuRecordSet.getInt("mb")+"").equals("-1")){

                    reusltModulIds.add(zhishuRecordSet.getInt("mb") + "");
                }
                //logger1.info("andInt==1==>zsIdsListName========>"+JSONUtil.toJSONString(zsIdsListName)+"=========>zsValue===>"+zhishuRecordSet.getString("zs"));
                if(zsIdsListName.lastIndexOf(zhishuRecordSet.getString("zs"))!=-1){
                    //logger1.info("andInt===1===>zsIdsListValue====>"+zsIdsListName.lastIndexOf(zhishuRecordSet.getString("zs")));
                    zsIdsListName.set(zsIdsListName.lastIndexOf(zhishuRecordSet.getString("zs")),zhishuRecordSet.getString("zs"));
                    if(!(zhishuRecordSet.getInt("mb")+"").equals("-1")){
                        dyZshListMap.put(zhishuRecordSet.getInt("mb") +"",zhishuRecordSet.getString("zs"));
                        dyMbIdsList.add(zhishuRecordSet.getInt("mb") +"");
                    }
                    if(itemZsDyModuId.containsKey(zhishuRecordSet.getString("zs"))){
                        List<String> oraginList=itemZsDyModuId.get(zhishuRecordSet.getString("zs"));
                        oraginList.add(zhishuRecordSet.getInt("mb") +"");
                        itemZsDyModuId.put(zhishuRecordSet.getString("zs"),oraginList);
                    }else {
                        itemZsDyModuId.put(zhishuRecordSet.getString("zs"),dyMbIdsList);
                    }
                }

            }


        }
        distainStr(gzkStringBUlider);
        gzkMap.put("gzkIds",gzkStringBUlider);
        if(recordSet!=null) {
            insertCanshList = insertCanshList.stream().distinct().collect(Collectors.toList());
            //logger1.info("insertCanshList===>" + JSONUtil.toJSONString(insertCanshList));

            if (!insertCanshList.isEmpty()) {

                boolean b2 = new RecordSet().executeBatchSql(insertZhishuTwoSql, insertCanshList);
                //logger1.info("b2===>" + b2);
            }
        }
        map.put("reusltModulIds",reusltModulIds);
        map.put("zsIdsListName",zsIdsListName);
        map.put("dyZshListMap",dyZshListMap);
        map.put("itemZsDyModuId",itemZsDyModuId);
        return map;
    }    // 当参数满足一条及以上的规则时，在任务内容中，应按段落堆叠内容话术。
    /**
     * 任务内容堆叠
     *
     * @param dyMouldeIds 调用模板ids
     * @return
     */
    public Map<String,Object> bulidTaskContent(List<String> dyMouldeIds,Map<String,StringBuilder> detailCountMap,List<String> zsIdsListName,Map<String,String> dyZshListMap,Map<String,List<String>> itemZsDyModuId) {
        if(zsIdsListName==null){
            zsIdsListName=new ArrayList<>();
        }
        Map<String,Object> mapPramsMap=new HashMap<>();
        StringBuilder stringBuilder = new StringBuilder();
        StringBuilder stringBuilderTwo = new StringBuilder();
        BaseBean baseBean = new BaseBean();
        ////logger1.info("detailCountMap===>"+detailCountMap);
        ////logger1.info("dyMouldeIds===>"+dyMouldeIds);
        ////logger1.info("zsIdsListName===>"+zsIdsListName);
//        List<String> zsList=new ArrayList<>();
//        List<String> zsNameList=new ArrayList<>();
//        Map<String,String> zsNameListMap=new HashMap<>();

        //标记如果添加过的致胜指数
        List<String> hasTipZszs=new ArrayList<>();

        //循环每个致胜指数对应的模板内容，如果没有，那么就是空的
        itemZsDyModuId.forEach((k,v)->{
            List<String> valueList=(List<String>) v;
            if(valueList!=null&&valueList.size()>0){
                RecordSet recordSet=new RecordSet();
                String mOduleSql = "select id,rwnr,fjsc from uf_mbk where "+Util.getSubINClause(StrUtil.join(",",valueList),"id","in");
                recordSet.execute(mOduleSql);
                RecordSet recordSet1=new RecordSet();
                String zStr="select id,zszs from uf_zszs where id="+k;
                ////logger1.info("zsStr===>"+zStr);
                recordSet1.execute(zStr);
                if(recordSet1.next()){
                    stringBuilder.append(recordSet1.getString("zszs")).append("\n");//致胜指数
                }
                while (recordSet.next()){
                    if(!stringBuilder.toString().contains(engListhTilte)){

                        stringBuilder.append(StrUtil.isEmpty(recordSet.getString("rwnr"))?engListhTilte:recordSet.getString("rwnr")).append("\n");
                    }
                }

            }else {
                RecordSet recordSet1=new RecordSet();
                String zStr="select id,zszs from uf_zszs where id="+k;
                hasTipZszs.add(k);
                ////logger1.info("zsStr===>"+zStr);
                recordSet1.execute(zStr);
                boolean ishasZs=false;
                if(recordSet1.next()){
                    stringBuilder.append(recordSet1.getString("zszs")).append("\n");//致胜指数
                    ishasZs=true;
                }
                if(ishasZs){

                    stringBuilder.append(engListhTilte).append("\n");//堆叠任务内容
                }
            }
        });
        if(!dyMouldeIds.isEmpty()){
            RecordSet recordSet = new RecordSet();
            String mOduleSql = "select id,rwnr,fjsc from uf_mbk where "+Util.getSubINClause(StrUtil.join(",",dyMouldeIds),"id","in");
            ////logger1.info("mOduleSql===>"+mOduleSql);
            recordSet.execute(mOduleSql);
//            int i=0;
//            if(zsIdsListName.size()>0){
//                RecordSet recordSet1=new RecordSet();
//                recordSet1.execute("select id,zszs from uf_zszs where "+Util.getSubINClause(StrUtil.join(",",zsIdsListName),"id","in"));
//                while (recordSet1.next()){
//                    zsNameList.add(recordSet1.getString("zszs"));
//                    zsNameListMap.put(recordSet1.getString("id"),recordSet1.getString("zszs"));
//                }
//            }

            while (recordSet.next()) {

//                if(zsIdsListName!=null&&!zsIdsListName.isEmpty()&&StrUtil.isNotBlank(zsIdsListName.get(i))){
//                    RecordSet recordSet1=new RecordSet();
//                    String zStr="select id,zszs from uf_zszs where id="+zsIdsListName.get(i);
//                    ////logger1.info("zsStr===>"+zStr);
//                    recordSet1.execute(zStr);
//                    if(recordSet1.next()){
//                ////logger1.info("zsNameList===>"+zsNameList+"====>i===>"+i);
//                if(i!=zsIdsListName.size()){
//
//                    stringBuilder.append(zsNameListMap.get(dyZshListMap.get(recordSet.getInt("id")+""))).append("\n");//致胜指数
//                    zsList.add(dyZshListMap.get(recordSet.getInt("id")+""));
//                }
//
////                    ////logger1.info("rwnR===>"+(StrUtil.isBlank(recordSet.getString("rwnr"))?engListhTilte:recordSet.getString("rwnr")));
//                stringBuilder.append(StrUtil.isBlank(recordSet.getString("rwnr"))?engListhTilte:recordSet.getString("rwnr")).append("\n");//堆叠任务内容
////                }else {
////                    ////logger1.info("rwNr2222===>"+(StrUtil.isBlank(recordSet.getString("rwnr"))?engListhTilte:recordSet.getString("rwnr")));
////                    stringBuilder.append(StrUtil.isBlank(recordSet.getString("rwnr"))?engListhTilte:recordSet.getString("rwnr")).append("\n");//堆叠任务内容
////                }
//                ////logger1.info("fjscvalue111====>"+recordSet.getString("fjsc"));
                stringBuilderTwo.append(recordSet.getString("fjsc")).append(",");//堆叠相关附件
//                i++;
//            }
////            ////logger1.info("deleteaAt111===>"+(stringBuilder.deleteCharAt(stringBuilder.lastIndexOf("\n"))));
////            if(StrUtil.isNotBlank(stringBuilder.toString())){
////
//                stringBuilder=new StringBuilder(stringBuilder.deleteCharAt(stringBuilder.lastIndexOf("\n")).toString());
////            }
////            if(stringBuilderTwo.toString().contains(",")){
//
//                stringBuilderTwo=new StringBuilder(stringBuilderTwo.deleteCharAt(stringBuilderTwo.toString().length() - 1).toString());
            }
//            if(i==zsIdsListName.size()-1){
//                for (int i1 = 0; i1 < zsIdsListName.size(); i1++) {
//                    for (int i2 = 0; i2 < zsList.size(); i2++) {
//                        if(zsList.get(i2).equalsIgnoreCase(zsIdsListName.get(i1))){
//                            stringBuilder.append(zsNameList.get(i1)).append("\n");//致胜指数
//                            stringBuilder.append(engListhTilte).append("\n");//堆叠任务内容
//                            break;
//                        }
//                    }
//                }
//
//            }



        }else{
            for (int i = 0; i < zsIdsListName.size(); i++) {
                if(hasTipZszs.contains(zsIdsListName.get(i))){
                    continue;
                }
                RecordSet recordSet1=new RecordSet();
                String zStr="select id,zszs from uf_zszs where id="+zsIdsListName.get(i);
                ////logger1.info("zsStr===>"+zStr);
                recordSet1.execute(zStr);
                if(recordSet1.next()){
                    stringBuilder.append(recordSet1.getString("zszs")).append("\n");//致胜指数
                }
//                stringBuilder.append(zsIdsListName.get(i)).append("\n");//致胜指数
//                stringBuilder.append(engListhTilte).append("\n");
//                if(!stringBuilder.toString().contains(engListhTilte)){

                    stringBuilder.append(engListhTilte).append("\n");//堆叠任务内容
//                }
            }
        }
        ////logger1.info("dyMouldeIds===>"+dyMouldeIds+"====>stringBUlder1111111===>"+stringBuilder+"=====>stringBuilderTwo===========>"+stringBuilderTwo);
        mapPramsMap.put("rwnr",stringBuilder);
        mapPramsMap.put("fjsc",stringBuilderTwo);
        return mapPramsMap;
    }

    /**
     * 找到模板冲突 ，符合规则的那一条 当任务互动类型在不同模板发生冲突时，选择“酒店现场”；当需上传附件发生冲突时，选择“是”；当任务到期日发生冲突时，选择较远的日期
     *
     * @return
     */
    public Map<String, Object> matchRuleFirsetModule(List<String> dyMouldeIds, Log baseBean) {
        Map<String, Object> oneMatchchMap = new HashMap<>();

        if(!dyMouldeIds.isEmpty()){
            String mOduleSql2="select id,rwnr,rwhdlx,xscfj,rwdqsj from uf_mbk where  "+Util.getSubINClause(StrUtil.join(",",dyMouldeIds),"id","in")+" order by rwhdlx asc limit 0,1";
            Map<String, Object> newSqlMapTwo = findNewSqlMap(dyMouldeIds,logger1, "rwhdlx",mOduleSql2);
            oneMatchchMap.put("rwhdlx",newSqlMapTwo.get("rwhdlx"));//任务互动类型//0=酒店现场,1=线下讨论

            String mOduleSql3="select id,rwnr,rwhdlx,xscfj,rwdqsj from uf_mbk where  "+Util.getSubINClause(StrUtil.join(",",dyMouldeIds),"id","in")+" order by xscfj asc limit 0,1";
            Map<String, Object> newSqlMapTHreee = findNewSqlMap(dyMouldeIds,logger1, "xscfj",mOduleSql3);
            oneMatchchMap.put("xscfj",newSqlMapTHreee.get("xscfj"));//是否上传附件//0=是，1=否

            String mOduleSql4="select id,rwnr,rwhdlx,xscfj,rwdqsj from uf_mbk where  "+Util.getSubINClause(StrUtil.join(",",dyMouldeIds),"id","in")+" order by rwdqsj desc limit 0,1";
            Map<String, Object> newSqlMapFour = findNewSqlMap(dyMouldeIds,logger1, "rwdqsj",mOduleSql4);
            String timeStr=DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd");
            //logger1.info("timeStr1===>"+timeStr);
            if(StrUtil.isNotBlank(newSqlMapFour.get("rwdqsj")==null?"":newSqlMapFour.get("")+"")){
                DateTime dateTime=DateUtil.offset(DateTime.now(),DateField.DAY_OF_YEAR,Integer.parseInt(StrUtil.isEmpty(newSqlMapFour.get("rwdqsj")+"")?"0":newSqlMapFour.get("rwdqsj")+""));
                timeStr=dateTime.toDateStr();
            }

            oneMatchchMap.put("rwdqsj",timeStr);//任务到期时间
        }


        return oneMatchchMap;
    }
    /**
     * 找到优先酒店现场排序最新的那条，和是否附件最新的那条，任务到期时间最新的那条
     */
    public Map<String,Object> findNewSqlMap(List<String> dyMouldeIds, Log baseBean,String fileName, String sql){
        Map<String, Object> oneMatchchMap = new HashMap<>();
        RecordSet recordSet = new RecordSet();
        String mOduleSql=sql;
        recordSet.execute(mOduleSql);
        if (recordSet.next()) {
            oneMatchchMap.put(fileName, recordSet.getString(fileName));//任务内容
        }
        //logger1.info("oneMatchMap1111==>" + JSONUtil.toJSONString(oneMatchchMap));
        return oneMatchchMap;
    }
    /**
     * @param hotelroleIds 人力资源ids 集合
     * @return
     */
    //找酒店岗位表中的企信id等于此人的loginid;
    public Boolean findAllRevieverLogindEquals(List<String> hotelroleIds) {
        Integer countAll = 1;
        if(hotelroleIds!=null&&!hotelroleIds.isEmpty()){
            String sql1="select count(1) as countId from uf_Master_Hotel_Role where "+Util.getSubINClause(StrUtil.join(",", hotelroleIds),"hotelrole","in");
            RecordSet recordSet = new RecordSet();
            recordSet.execute(sql1);
            if (recordSet.next()) {
                countAll = recordSet.getInt("countId");
            }
        }
        return countAll > 0;
    }

    //通过map的id找到相应的map
    public Map<String, Object> getMapObject(List<Map<String, Object>> mapList, String id) {
        AtomicReference<Map<String, Object>> result = new AtomicReference<>();
        for (Map<String, Object> stringObjectMap : mapList) {
            stringObjectMap.forEach((k, v) -> {
                if (k.equalsIgnoreCase(id)) {
                    result.set((Map<String, Object>) v);
                }
            });
        }
        return result.get();
    }
    public void complexStringKeyReturn(Map<String, Boolean> resultMap, Map itemData) {
        String compleKey = "";
        String cjrStr = (String) itemData.get("znbscjgw");//创建人
        String sjrStr = (String) itemData.get("znbssjgw");//收件人
        if (cjrStr != null && !cjrStr.equals("")) {
            String[] cjrStrArray = cjrStr.split(",");
            int[] cjIntArray = new int[cjrStrArray.length];
            for (int j = 0; j < cjrStrArray.length; j++) {
                cjIntArray[j] = Integer.parseInt(cjrStrArray[j]);
            }
            Arrays.sort(cjIntArray);//从小到大数组 ，数字排序
            compleKey = StrUtil.join(",", cjIntArray);
        }
        String complexTwo = "";
        if (sjrStr != null && !sjrStr.equals("")) {
            String[] sjrStrArray = sjrStr.split(",");
            int[] sjrIntArray = new int[sjrStrArray.length];
            for (int j = 0; j < sjrIntArray.length; j++) {
                sjrIntArray[j] = Integer.parseInt(sjrStrArray[j]);
            }
            Arrays.sort(sjrIntArray);//从小到大数组 ，数字排序
            complexTwo = StrUtil.join(",", sjrIntArray);
        }
        resultMap.put(itemData.get("INNCODE") + "_" + compleKey + complexTwo, compleKey.equals(complexTwo));
    }

    public  void cmpleteMap( Map<String, Object> mapOneDataMap,RecordSet recordSet1,Log baseBean,List<String> zzzsStrList){
//                mapOneDataMap.put("fxzck",recordSet.getDouble("fxzck"));//风险值参考
        mapOneDataMap.put("INNCODE", recordSet1.getInt("INNCODE"));//酒店代码
        mapOneDataMap.put("MTRX", recordSet1.getInt("MTRX"));//指数名称
        mapOneDataMap.put("Scenario", recordSet1.getInt("csmc"));//参数名称
        mapOneDataMap.put("yrmtnbr", recordSet1.getString("yrmtnbr").replace("\n","").replace("\t",""));//yrmtnbr
        mapOneDataMap.put("MTDTRGT", recordSet1.getString("MTDTRGT"));//月度目标
        mapOneDataMap.put("ydmb", recordSet1.getString("ydmb"));//月度目标
        mapOneDataMap.put("MTDResult", recordSet1.getString("MTDResult"));//月度结果
        mapOneDataMap.put("ydjg", recordSet1.getString("ydjg"));//月度结果
        mapOneDataMap.put("YTDTRGT", recordSet1.getString("YTDTRGT"));//年度目标
        mapOneDataMap.put("ndmb", recordSet1.getString("ndmb"));//年度目标
        mapOneDataMap.put("YTDResult", recordSet1.getString("YTDResult"));//年度结果
        mapOneDataMap.put("ndjg", recordSet1.getString("ndjg"));//年度结果
        mapOneDataMap.put("RiskValue", recordSet1.getString("RiskValue"));//风险值
//        mapOneDataMap.put("RACISZ", recordSet1.getString("RACISZ"));//raci指数多选
        mapOneDataMap.put("id", recordSet1.getString("id"));//更新发送智能部署

        //找到Raci创建岗位里面的岗位，和接收岗位的id值

        RecordSet recordSetRaci=new RecordSet();
        List<String> raciIdList=new ArrayList<>();
        ////logger1.info("recordSet1.getString(\"RACISZ\")1111===>"+mapOneDataMap.get("RACISZ"));
        if((mapOneDataMap.get("RACISZ")+"").split(",").length>0){
            ////logger1.info("recordSet1.getString(\"RACISZ\")===>"+mapOneDataMap.get("RACISZ").toString());
            if(StrUtil.isNotBlank(mapOneDataMap.get("RACISZ").toString())){

                String raciFindSql="select id,znbscjgw,znbssjgw,znbscsgw,znbszxgwcs from uf_indexsetting  from uf_indexsetting where "+Util.getSubINClause(mapOneDataMap.get("RACISZ").toString(),"id","in");
                ////logger1.info("raciFindSql===>"+raciFindSql);
                recordSetRaci.execute("select id,znbscjgw,znbssjgw,znbscsgw,znbszxgwcs from uf_indexsetting where "+Util.getSubINClause(mapOneDataMap.get("RACISZ").toString(),"id","in"));
                mapOneDataMap.put("Exclusion", recordSet1.getString("Exclusion"));//Exclusion
                mapOneDataMap.put("outbound", recordSet1.getString("outbound"));//outbound
                mapOneDataMap.put("pc", recordSet1.getString("pc"));//批次
                mapOneDataMap.put("qrzt", recordSet1.getInt("qrzt"));//确认状态
                while (recordSetRaci.next()) {
                    mapOneDataMap.put("znbscjgw", recordSetRaci.getString("znbscjgw"));//rasi表里面的创建岗位
                    mapOneDataMap.put("znbssjgw", recordSetRaci.getString("znbssjgw"));//rasi表里面的收件岗位
                    mapOneDataMap.put("znbscsgw", recordSetRaci.getString("znbscsgw"));//rasi表里面的抄送岗位 智能部署-酒店岗位抄送
                    mapOneDataMap.put("znbszxgwcs", recordSetRaci.getString("znbszxgwcs"));//rasi表里面的智能部署-职能部门抄送
                    if(zzzsStrList.contains(recordSet1.getInt("MTRX")+"")){

                        mapOneDataMap.put("twoSame", recordSetRaci.getString("znbscjgw") + "_" + recordSetRaci.getString("znbssjgw")+"_special");
                    }else {
                        mapOneDataMap.put("twoSame", recordSetRaci.getString("znbscjgw") + "_" + recordSetRaci.getString("znbssjgw"));

                    }
                    raciIdList.add(recordSetRaci.getInt("id")+"");
                }
                mapOneDataMap.put("raciIdList",raciIdList);
            }else {
                mapOneDataMap.put("raciIdList",new ArrayList<>());
            }

        } else {
            mapOneDataMap.put("znbscjgw", "");//rasi表里面的创建岗位
            mapOneDataMap.put("znbssjgw", "");//rasi表里面的收件岗位
            mapOneDataMap.put("znbscsgw", "");//rasi表里面的收件岗位
            mapOneDataMap.put("znbszxgwcs", "");//rasi表里面的-职能部门抄送
            mapOneDataMap.put("twoSame","true");
            mapOneDataMap.put("raciIdList",new ArrayList<>());
        }
    }


    /**
     * 找到酒店代码和酒店类型同一个的，指数集合
     *
     * @param findFiledStr 找的字段名字集合
     * @return
     */

    public List<Object> getBiaojiList(String findFiledStr, String hotelKey, Map<String, List<Map<String, Object>>> taskDataList) {
        List<Object> reusltList = new ArrayList<>();
        taskDataList.forEach((k, v) -> {
            if (hotelKey.equalsIgnoreCase(k.split("_")[0])) {
                for (Map<String, Object> stringObjectMap : v) {
                    reusltList.add(stringObjectMap.get(findFiledStr));

                }
            }
        });
        return reusltList;
    }

    //根据id找到相应的酒店中文名称
    public List<Map<String, Object>> getHotelName(List<String> idList) {
        List<Map<String, Object>> addList = new ArrayList<>();
        String join = String.join(",", idList);
        RecordSet recordSet = new RecordSet();
        String sql = "select hotelnamezh,holidex,id from uf_hotelinfo where id in (" + join + ")";
        recordSet.execute(sql);
        if (recordSet.next()) {
            Map<String, Object> paramsMap = new HashMap<>();
            paramsMap.put("jddm", recordSet.getString("holidex"));
            paramsMap.put("jdmc", recordSet.getString("hotelnamezh"));
            paramsMap.put("zszs", recordSet.getInt("id"));
            addList.add(paramsMap);
        }
        return addList;
    }


    //根据酒店id 值找到所有的 区域，品牌，管理模式
    public Map<String, Object> getHotelNameMap(List<String> idList) {
        Map<String, Object> addMap = new HashMap<>();
        String join = String.join(",", idList);
        RecordSet recordSet = new RecordSet();
        String sql = "select region,brand,id,relationship from uf_hotelinfo where id in (" + join + ")";
        recordSet.execute(sql);
        while (recordSet.next()) {
            Map<String, Object> paramsMap = new HashMap<>();
            paramsMap.put("region", recordSet.getString("region"));//区域
            paramsMap.put("brand", recordSet.getString("brand"));//品牌
            paramsMap.put("relationship", recordSet.getString("relationship"));//	管理模式
            paramsMap.put("id", recordSet.getInt("id"));
            addMap.put(recordSet.getInt("id") + "", paramsMap);
        }
        return addMap;
    }
    //根据酒店id 值找到所有的 区域，品牌，管理模式
    public Map<String, Object> getHotelNameMap(String idList) {
        Map<String, Object> addMap = new HashMap<>();
        RecordSet recordSet = new RecordSet();
        String sql = "select region,brand,id,relationship from uf_hotelinfo where id in (" + idList + ")";
        recordSet.execute(sql);
        while (recordSet.next()) {
            Map<String, Object> paramsMap = new HashMap<>();
            paramsMap.put("region", recordSet.getString("region"));//区域
            paramsMap.put("brand", recordSet.getString("brand"));//品牌
            paramsMap.put("relationship", recordSet.getString("relationship"));//	管理模式
            paramsMap.put("id", recordSet.getInt("id"));
            addMap.put(recordSet.getInt("id") + "", paramsMap);
        }
        return addMap;
    }
    //根据酒店id 值找到所有的酒店偏好的值创建任务下拉框值，基本信息，任务内容,自动发送，
    public Map<String, Object> getuf_phszList(List<String> idList,StringBuilder zszsStr) {
        Map<String, Object> addMap = new HashMap<>();
        String join = String.join(",", idList);
        RecordSet recordSet = new RecordSet();
        BaseBean baseBean=new BaseBean();
        List<String> zsZsList= Arrays.stream(zszsStr.toString().split(",")).filter(s->!",".equals(s)).collect(Collectors.toList());
        baseBean.writeLog("zsZsList====>"+JSONUtil.toJSONString(zsZsList));
        zsZsList.forEach(r->{
            String sql = "select * from uf_phsz where hotelcode in (" + join + ") and find_in_set(' " +r+"',zszs) and tbphxz>0 order by tbphxz desc limit 0,1";
            //logger1.info("sql33333333333333333===>"+sql);
            recordSet.execute(sql);
            while (recordSet.next()) {
                Map<String, Object> paramsMap = new HashMap<>();
                paramsMap.put("jcjrw", recordSet.getInt("jcjrw"));//仅创建任务 Check框值
                paramsMap.put("cjrw", recordSet.getInt("jcjrw"));//创建任务改成仅创建任务的 Check框值
                paramsMap.put("tbphxz", recordSet.getInt("tbphxz"));//创建任务改成仅创建任务的 Check框值
                paramsMap.put("jbxx", recordSet.getInt("jbxx"));//基本信息 Check框值,空=null，勾选=1，不勾选=0
                paramsMap.put("rwnr", recordSet.getInt("rwnr"));//任务内容 Check框值,空=null，勾选=1，不勾选=0
                paramsMap.put("zdfs", recordSet.getInt("zdfs"));//自动发送 Check框值,空=null，勾选=1，不勾选=0
                paramsMap.put("id", recordSet.getInt("id"));
                addMap.put(recordSet.getInt("hotelcode") + "", paramsMap);
            }
            //logger1.info("getuf_phszList===>addMap===>"+ JSONUtil.toJSONString(addMap));
        });
        //logger1.info("getuf_phszList===>addMap===>"+ JSONUtil.toJSONString(addMap));
        return  addMap;
    }


    //根据id找到相应的酒店中文代码
    public String getHotelNameholidex(int id) {
        RecordSet recordSet = new RecordSet();
        String sql = "select holidex from uf_hotelinfo where id=?";
        recordSet.executeQuery(sql, id);
        if (recordSet.next()) {
            return recordSet.getString("holidex");
        }
        return "";
    }

    /**
     * 获取模块id
     * @param tabName
     * @return
     */
    private  int getModeid(String tabName){
        RecordSet rs = new RecordSet();
        RecordSet ra = new RecordSet();
        rs.executeQuery("select * from WORKFLOW_BILL where tablename=?",tabName);
        rs.next();
        String id = rs.getString("id");
        ra.executeQuery("select * from MODEINFO where formid=?",id);
        ra.next();
        int modeid = Integer.parseInt(ra.getString("id"));
        return modeid;
    }
%>


<%


//    Logger logger= LoggerFactory.getLogger(this.getClass());
//    Logger logger1=LoggerFactory.getLogger(this.getClass());

//       Logger logger1 = LoggerFactory.getLogger("cronxyzJsp");
    try {
        deleteUpdateGfxTable();
//    BaseBean baseBean = new BaseBean();
        ////logger1.info("intoThisPage====>createHighCron.jsping.....");
//    List<String> tagList=new ArrayList<>();
//    RecordSet tagRecordSet=new RecordSet();
//    tagRecordSet.execute("select id,tagmc,tagbh from uf_tag");
//    while (tagRecordSet.next()){
//        tagList.add(tagRecordSet.getInt("id")+"");
//    }
    ////logger1.info("findTagList===>"+JSONUtil.toJSONString(tagList));

    //select (select zszslx from uf_indexsetting where zsmc=ufmd.MTRX limit 0,1) as zszslx,(select znbscjgw from uf_indexsetting where zsmc=ufmd.MTRX limit 0,1) as znbscjgw,(select znbssjgw from uf_indexsetting where zsmc=ufmd.MTRX limit 0,1) as znbssjgw, ufmd.id as id,ufmd.yrmtnbr as YTMR,ufmd.INNCODE,ufmd.MTRX,ufmd.yrmtnbr,ufmd.csmc,ufmd.ydmb,ufmd.ydjg,ufmd.ndmb,ufmd.ndjg,ufmd.exclusion,ufmd.outbound,ufmd.pc,ufmd.qrzt,ufsetting.znbscjgw,ufsetting.znbssjgw,ufsetting.znbscsgw,(select MTDTRGT from uf_DWD_Winning_Metr where yrmtnbr=ufmd.ytmr and ufmd.INNCODE=INNCODE and utmd.MTRX=MTRX  order by modedatacreatedate,pc desc limit 0,1) as MTDTRGT,(select MTDResult from uf_DWD_Winning_Metr where yrmtnbr=ufmd.ytmr and ufmd.INNCODE=INNCODE and utmd.MTRX=MTRX  order by modedatacreatedate,pc desc limit 0,1) as MTDResult,(select YTDTRGT from uf_DWD_Winning_Metr where yrmtnbr=ufmd.ytmr and ufmd.INNCODE=INNCODE and utmd.MTRX=MTRX  order by modedatacreatedate,pc desc limit 0,1) as YTDTRGT,(select YTDResult from uf_DWD_Winning_Metr where yrmtnbr=ufmd.ytmr and ufmd.INNCODE=INNCODE and utmd.MTRX=MTRX order by modedatacreatedate,pc desc limit 0,1) as YTDResult,ufmd.ydmb as ydmb,ufmd.ydjg as ydjg,ufmd.ydyz as ydyz,ufmd.ndmb as ndmb,ufmd.ndjg as ndjg,ufmd.ndyz as ndyz from uf_DWD_Smart_Deployment_Reference ufmd left join  uf_indexsetting ufsetting on ufsetting.zsmc=ufmd.id where ufmd.sfgfx=0 and ufmd.qrzt=1 and ufmd.yrmtnbr='2024-11' and sfcg <> 0 and  sfyfs <> 0
//    ////logger1.info("filedName===>" + filedName + "====>CreateHighRiskTaskCron===>" + findOrainSqlStr);

    RecordSet recordSet = new RecordSet();
    RecordSet recordSetBefore=new RecordSet();
    recordSetBefore.execute("select formmodeid from uf_znbsqd limit 0,1");
    Integer formmodeid=null;
    if(recordSetBefore.next()){
        formmodeid=recordSetBefore.getInt("formmodeid");
    }else{
        formmodeid= getModeid("uf_znbsqd");
    }

    String format = DateUtil.format(LocalDateTime.now(), "yyyy-MM-dd");
    String formatTwoYTMR = DateUtil.format(LocalDateTime.now().plusMonths(-1), "yyyyMM");
    ////logger1.info("formatTwo====>ytmr===>"+formatTwoYTMR);
    //modedatacreatedate,modedatacreatetime
    String timeStr = DateUtil.format(LocalDateTime.now(), "HH-mm:ss");
    //查询出来 指数信息基础表 uf_DWD_Winning_Metr 的字段值，是否超过阀值
    String findSql =" (SELECT *\n" +
                "FROM uf_gfxzsxxgl main\n" +
                "INNER JOIN (\n" +
                "    SELECT INNCODE as INNCODE1, \n" +
                "           MTRX as MTRX1,\n" +
                "           MAX(left(yrmtnbr,6)) AS yrmtnbr1\n" +
                "    FROM uf_gfxzsxxgl\n" +
                "    GROUP BY INNCODE, MTRX\n" +
                ") tmp \n" +
                "ON main.INNCODE = tmp.INNCODE1 \n" +
                "   AND main.MTRX = tmp.MTRX1 \n" +
                "   AND left(main.yrmtnbr,6)  = tmp.yrmtnbr1 where";
    findSql="select * from "+findSql+"  (sfcg is null or sfcg=1) and  (sfyfs is null or sfyfs <>4) and (IFNULL(isresend,0)<1))B  where B \n" +
            ".INNCODE <> '' and B.INNCODE is not null  and qrzt=1 and (sfyscdfqd is null or (sfyscdfqd <>2 and sfyscdfqd <>0)) and RiskValue is not null and (sfwjsj is null or sfwjsj=0) ";//0=已发送，1:未发
    //logger1.info("foramt===>"+format+"===>-----CreateHighRiskTaskCron Excute==>" + "===>findSql===>" + findSql);
    recordSet.execute(findSql);
    //高风险插入sql
//    String insertHigRishTableSql = "insert into uf_gfxzsxxgl (INNCODE,MTRX,yrmtnbr,Scenario,MTDTRGT,ydmb,MTDResult,ydjg,YTDTRGT,ndmb,YTDResult,ndjg,exclusion,outbound,pc,qrzt,RiskValue) values(?," +
//            "?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
//    ////logger1.info("insertHigRishTableSql====>" + insertHigRishTableSql);
//    List<List> params = new ArrayList<>();

    //找配置的建模表中特殊的致胜指数 集，这两指数不合并，并且要拆分
    RecordSet ufSpecialZzszs=new RecordSet();
    ufSpecialZzszs.execute("select id,zszs from uf_tszszsdyb");
    String zszsStr1="";
    if(ufSpecialZzszs.next()){
        ////logger1.info("findSpeacilSql===>"+"select id,zszs from uf_tszszsdyb");
        zszsStr1=ufSpecialZzszs.getString("zszs");
        ////logger1.info("zszsStr1=r====>"+zszsStr1);
    }
    String []zzzsStrArray=zszsStr1.split(",");//特殊致胜指数集
    List<String> zzzsStrList=Arrays.asList(zzzsStrArray);
    ////logger1.info("zzzsStrList======>"+JSONUtil.toJSONString(zzzsStrList));
    List<Map<String, Object>> highRiskDataList = new ArrayList<>();
    while (recordSet.next()) {
        ////logger1.info("id===>"+recordSet.getInt("id")+"======>intoRecosetHgisFor===>"+"Exclusion===>"+recordSet.getString("Exclusion")+"===>"+"====>outbound===>"+recordSet.getString("outbound"));
        if("1".equals(recordSet.getString("Exclusion"))||"1".equals(recordSet.getString("outbound"))){
            continue;
        }
        Map<String, Object> mapOneDataMap = new HashMap<>();
//              cmpleteMa

//        致胜指数有值
//                    double riskValueTtem = Double.parseDouble(recordSet.getString("RiskValue") == null ? "0" : recordSet.getString("RiskValue") + "");
//            String jsonStr="select utfseting.id as id,utfseting.xyh2,utfseting.gllx,utfseting.dq,utfseting.pp,utfseting.id,utfseting.znbscjgw,utfseting.znbssjgw,utfseting.znbscsgw,utfseting.xyh,utfseting.fxzmin,utfseting.zsmc,utfseting.fxzmax," +
//                    "ufzszx.zslx,utfseting.zszslx from uf_indexsetting utfseting  " +
//                    " inner join uf_zszs ufzszx on utfseting.zsmc=ufzszx.id " +
////                    " left join uf_hotelinfo ufhotel ufhotel.id="+inncodeID +
//                    " where utfseting.zszslx=ufzszx.zslx and ";
//
        RecordSet recordSet1=new RecordSet();
//
//            StringBuilder sqlZHishuStr = new StringBuilder(jsonStr);
////            paramsMap.put("region", recordSet.getString("region"));//区域
////            paramsMap.put("brand", recordSet.getString("brand"));//品牌
////            paramsMap.put("relationship", recordSet.getString("relationship"));//	管理模式
//            Map inncodeMap=getHotelNameMap(recordSet.getInt("INNCODE")+"");
//            Map<String,Object> inncodeItemMapTwo = (Map<String,Object>)inncodeMap.get(recordSet.getInt("INNCODE")+"");
//            String relationship1 = (String) inncodeItemMapTwo.get("relationship");//管理类型
//            ////logger1.info("relationship1====>"+relationship1);
//            String region1 = (String) inncodeItemMapTwo.get("region");//区域
//            ////logger1.info("region1====>"+region1);
//            String brand1 = (String) inncodeItemMapTwo.get("brand");//品牌
//            ////logger1.info("brand1====>"+brand1);
        List<String> dataList = new ArrayList<>();
        dataList.add(recordSet.getString("MTRX"));
//            /**
//             * （风险值MIN fxzmin ） （小于号 xyh） 高风险表[高风险值]  （小于号2 xyh2)  (
//             * 风险值MAX
//             *
//             * fxzmax
//             * )
//             */
//
////            5<=10<=20
//            ////logger1.info("datas===>" + JSONUtil.toJSONString(datas));
//            sqlZHishuStr.append(Util.getSubINClause(StrUtil.join(",",datas),"utfseting.zsmc","in"));
//            sqlZHishuStr.append(" and gllx like '%")
//                    .append(inncodeItemMapTwo.get("relationship")).append("%' and  ")
//                    .append(Util.getSubINClause(StrUtil.join(",", getAllIdsList(inncodeItemMapTwo)), "pp", "in"))
//                    .append(" and ( ").append(Util.getSubINClause(StrUtil.join(",", getAllDqIdsList(inncodeItemMapTwo)), "dq", "in")).append(" or dq like '%b')");
//            ////logger1.info("sqlZHishuStr===>" + sqlZHishuStr.toString());


        String str="select uis.id as uisId from uf_indexsetting uis\n" +
                "         INNER JOIN uf_hotelinfo uhi\n" +
                "                    ON (FIND_IN_SET(REPLACE(uhi.region, ',', ' '),\n" +
                "                                    (select group_concat(REPLACE(region, ',', ' '))\n" +
                "                                     from uf_hotelinfo\n" +
                "                                     where FIND_IN_SET(CONCAT(id, 'a'), uis.dq) > 0)\n" +
                "                        ) > 0 or uis.dq like '%b')\n" +
                "                        and FIND_IN_SET(REPLACE(uhi.brand, ',', ' '),\n" +
                "                                        (select group_concat(REPLACE(brand, ',', ' '))\n" +
                "                                         from uf_hotelinfo\n" +
                "                                         where FIND_IN_SET(id, uis.pp) > 0)\n" +
                "                            ) > 0\n" +
                "                        and uhi.id = "+recordSet.getInt("INNCODE")+"\n" +
                "                        and FIND_IN_SET(uhi.relationship, uis.gllx) > 0\n" +
                " where "+Util.getSubINClause(StrUtil.join(",",dataList)," uis.zsmc","in")+"\n" +
                "  and ("+recordSet.getString("RiskValue")+" between uis.fxzmin and IFNULL(NULLIF(uis.fxzmax, ''), 999999999))";
        str=str.replace("\n","");
        //logger1.info("str===>"+str);
        StringBuilder raciStrStrinigBulider=new StringBuilder();
        recordSet1.execute(str);
        while (recordSet1.next()) {
//
            ////logger1.info("matchData===>111==>"+recordSet1.getString("id"));

            raciStrStrinigBulider.append(recordSet1.getString("uisId")).append(",");
//                znbscjgwStr.append(recordSet1.getString("znbscjgw")).append(",");
//                znbssjgwwStr.append(recordSet1.getString("znbssjgw")).append(",");
//                znbscsgwwStr.append(recordSet1.getString("znbscsgw")).append(",");
//                relationshipForUfZnbs=(String) inncodeItemMap.get("relationship");
        }
        distainStr(raciStrStrinigBulider);
        mapOneDataMap.put("RACISZ",raciStrStrinigBulider.toString());

        ////logger1.info("raciStrStrinigBuliderToString()===>"+raciStrStrinigBulider.toString());
        cmpleteMap(mapOneDataMap,recordSet,logger1,zzzsStrList);
        //logger1.info("raciIdListFor111==>"+mapOneDataMap.get("raciIdList")+"====>raciszStrxyz====>"+mapOneDataMap.get("RACISZ")+"maoONedataMap.get(MTRX)--->"+mapOneDataMap.get("MTRX")+"====>zzzsStrList===>"+JSONUtil.toJSONString(zzzsStrList));
        if((Integer)recordSet.getInt("MTRX")>0&&zzzsStrList.contains(recordSet.getInt("MTRX")+"")){
            String []raciMoreStr=(mapOneDataMap.get("RACISZ")+"").split(",");
            List<String> raciMoreList= Arrays.stream(raciMoreStr).filter(s->!"".equals(s)).distinct().collect(Collectors.toList());
            //logger1.info("raciMoreStr==>"+Arrays.toString(raciMoreStr));

            List<String> raciIdListfor= (List<String>) mapOneDataMap.get("raciIdList");
            ////logger1.info("raciIdListFor===>"+raciMoreList+"====>raciMoreStr====>"+raciMoreStr);
            for (int i = 0; i < raciMoreList.size(); i++) {
                if(StrUtil.isNotBlank(raciMoreList.get(i))) {
                    Map<String, Object> otherMap = new HashMap<>(mapOneDataMap);
                    otherMap.remove("RACISZ");
                    otherMap.remove("twoSame");
                    //logger1.info("i====>" + i + "===>raciSz===>" + raciMoreList.get(i));
                    //logger1.info("twoSame====>" + i + "===>twoSame===>" + raciMoreList.get(i));
                    otherMap.put("RACISZ", raciMoreList.get(i));
                    RecordSet recordSetRaci = new RecordSet();
                    recordSetRaci.execute("select id,znbscjgw,znbssjgw,znbscsgw,znbszxgwcs from uf_indexsetting where " + Util.getSubINClause(raciMoreList.get(i), "id", "in"));
                    if (recordSetRaci.next()) {
                        otherMap.put("twoSame", recordSetRaci.getString("znbscjgw") + "_" + recordSetRaci.getString("znbssjgw")+"_special");
                        otherMap.put("znbscjgw", recordSetRaci.getString("znbscjgw"));//rasi表里面的创建岗位
                        otherMap.put("znbssjgw", recordSetRaci.getString("znbssjgw"));//rasi表里面的收件岗位
                        otherMap.put("znbscsgw", recordSetRaci.getString("znbscsgw"));//rasi表里面的抄送岗位 智能部署-酒店岗位抄送
                        otherMap.put("znbszxgwcs", recordSetRaci.getString("znbszxgwcs"));//rasi表里面的智能部署-职能部门抄送
                        highRiskDataList.add(otherMap);
                    }else{
                        highRiskDataList.add(mapOneDataMap);//此处要补充任务类型的处理
                    }
                    //logger1.info("i====>" + i + "===>otherMap===>" + JSONUtil.toJSONString(otherMap) + "====>mapOneDataMap=======>" + JSONUtil.toJSONString(mapOneDataMap));

                    //logger1.info(("highRiskDataListItemDataFind====>i====>" + i + "===>" + JSONUtil.toJSONString(highRiskDataList)));
                }

            }
            if(raciMoreList.isEmpty()){
                //logger1.info("raciMoreListISNotEmpty===>");
                highRiskDataList.add(mapOneDataMap);//此处要补充任务类型的处理
            }

        }else {
            //logger1.info("intoThis====>Twoo====>");
            highRiskDataList.add(mapOneDataMap);//此处要补充任务类型的处理
        }

    }


    //logger1.info("highRiskDataList高风险数据，查询结果为111111111===>" + JSONUtil.toJSONString(highRiskDataList));

    Map<String, List<Map<String, Object>>> comleteList = new HashMap<>();
    long startTime = System.currentTimeMillis();
    for (int i = 0; i < highRiskDataList.size(); i++) {
        Map<String,Object> itemData = highRiskDataList.get(i);
        //logger1.info("itemDataBefore===>"+JSONUtil.toJSONString(itemData));
        //logger1.info("itemDataEndkeyItemMap===>"+JSONUtil.toJSONString(itemData));

        String compleKeyValue = itemData.get("INNCODE")+"_"+itemData.get("twoSame");//获取到组合key
        //logger1.info("compleKeyValue====>"+compleKeyValue);
        //logger1.info("comleteList=======>"+JSONUtil.toJSONString(comleteList));


        if (comleteList.containsKey(compleKeyValue)) {//当组合key 接收人，收件人相等，第一次遍历时需要进行统一只新增一次，取出itemData新增即可;
            //map循环是hash排序的，itemdata是map的其中一个元素。
            //合并新增到智能部署一行中
            List<Map<String, Object>> itemListData = comleteList.get(compleKeyValue);
            itemListData.add(itemData);
            //新增完以后标记到List集合中
            comleteList.put(compleKeyValue, itemListData);
            //logger1.info("oneForCompleteList==>"+JSONUtil.toJSONString(comleteList));
        }  else {
            ////logger1.info("elseIntoTHis====>");
            List<Map<String, Object>> itemListData = new ArrayList<>();
            itemListData.add(itemData);
            //logger1.info("itemListData====>"+itemListData);
            //新增完以后标记到List集合中
            comleteList.put(compleKeyValue, itemListData);
            //logger1.info("TwoForCompleteList==>"+JSONUtil.toJSONString(comleteList));
        }

    }
    long endTime = System.currentTimeMillis();
    //logger1.info("for1===>costENdend1111===>time===>is===>" + (endTime - startTime) + "========>ms");

    ////logger1.info("taskDataList===>" + JSONUtil.toJSONString(comleteList));
    List<List> realParams = new ArrayList<>();
//        String filedNameStr = "jdmc,jddm,zszs,rwbt,cjgwry,sjgwry,csgwry,dymb,rwlx,sftxrwjbxx,sftxrwnr,znbszt,rwhdlx,xscfj,rwdqsj,rwnr";//酒店名称，酒店代码，致胜指数,任务标题,创建岗位人员,	抄送岗位人员,	收件岗位人员,是否基本信息填写，是否基本内容填写,智能部署状态,任务互动类型,	需上传附件,任务到期时间,任务内容
    String filedNameStr="rwscfs,mxycpd,yrmonbr,gldq,gfxzsxx,sfyfs,racisz,rwbq,jdmc,jdmcy,jdmcy2,jddm,jdfzfz,zszs,rwbt,cjgw,cjgwry,sjgwry,csgwry,jdlx,formmodeid,gzk,dymb,rwlx,znbm,sjgw,csgw,znbmcs,fqgly,rwhdlx,xscfj,rwdqsj,rwnr,xgfj,sfxytxjbxxzd,sfxytxrwnr,sftxrwjbxx,sftxrwnr,znbszt,modedatacreatedate,modedatacreatetime";
    RecordSet rwbqRecord=new RecordSet();
    rwbqRecord.execute("select id from uf_tag where tagmc='High Risk' limit 0,1");
    int rwbqId=-1;
    if(rwbqRecord.next()){
        rwbqId=rwbqRecord.getInt("id");
        ////logger1.info("findRwbqIdValue===>rwbqId===>"+rwbqId);
    }else{
        ////logger1.info("rwbqIdOneId====>"+rwbqId);
        rwbqId=getModeid("uf_tag");
    }
    ////logger1.info("rwbqId===>"+rwbqId);
    List<String> fileNameStrList = Arrays.asList(filedNameStr.split(","));
    StringBuilder questionStr=new StringBuilder();
    for (Object o : fileNameStrList) {
        questionStr.append("?").append(",");
    }
    if (questionStr.toString().lastIndexOf(",") != -1) {
        ////logger1.info("questionStrStrBerfore===>" + questionStr);
        questionStr = new StringBuilder(questionStr.substring(0, questionStr.lastIndexOf(",")));
        ////logger1.info("questionStrStrEndAfter===>" + questionStr);
    }
    String insertTaskSql = "insert into uf_znbsqd (" + filedNameStr + ") values("+questionStr.toString()+") ";//插入到智能部署表中
    ////logger1.info("insertTaskSql===>"+insertTaskSql);
    List<String> inncodeList = new ArrayList<>();
    List<String> zsZsIdList = new ArrayList<>();
    if(highRiskDataList.size()==0){
        return;
    }
    for (Map<String, Object> stringObjectMap : highRiskDataList) {
        inncodeList.add(stringObjectMap.get("INNCODE")+"");

        zsZsIdList.add(StrUtil.isBlankIfStr(stringObjectMap.get("MTRX"))?"":stringObjectMap.get("MTRX")+"");
    }

    Map inncodeMapData = getHotelNameMap(inncodeList);
     long startSecondTime = System.currentTimeMillis();
    ////logger1.info("zsZsIdLisMap===>"+JSONUtil.toJSONString(zzzsStrList));

    Integer finalFormmodeid = formmodeid;
    List<List> idsList=new ArrayList<>();
    int finalRwbqId = rwbqId;
    List<List> finalRealParams = realParams;
    comleteList.forEach((k, v) -> {
        Integer inncodeID = Integer.parseInt(k.split("_")[0]);
        //致胜指数合并,
        StringBuilder zszsStr = new StringBuilder();
        for (Map<String, Object> stringObjectMap : v) {
            zszsStr.append(stringObjectMap.get("MTRX")).append(",");
        }
        List<String> inncodeListOne=new ArrayList<>();
        inncodeListOne.add(inncodeID+"");
        long startTimeThree=System.currentTimeMillis();
        Map uf_phszListMapData = getuf_phszList(inncodeListOne,zszsStr);//根据酒店代码找到所有的偏好设置
        Map ufPhMapDataMap = (Map) uf_phszListMapData.get(inncodeID+"");//获取偏好设置每一项

        if (ufPhMapDataMap!=null&&ufPhMapDataMap.containsKey("")&&((ufPhMapDataMap.get("tbphxz") == null)|| (ufPhMapDataMap.get("tbphxz") + "").equals("-1")||(ufPhMapDataMap.get("tbphxz") + "").equals("0"))) {//创建任务没勾选的情况下,此智能部署清单不生成
            return;
        }
        long endTimeThree=System.currentTimeMillis();
        //logger1.info("endThreeeSearchFo3===>"+(endTimeThree-startTimeThree)+"=======>ms");
        List<Object> beanParamsTwo = new ArrayList<>();

        //酒店指数代码合并，
        StringBuilder hotelStr = new StringBuilder();
        //高风险指数信息字符串构造器
        StringBuilder gfxzsxxStr = new StringBuilder();
        //致胜指数合并,
        StringBuilder raciStrValue = new StringBuilder();
        //所有的raisvAlue 集合值
        Map<String,Double> rasiValueList = new HashMap<>();
//        //logger1.info("inncode1====>"+inncodeID+"===>inncodeMapData2===>"+inncodeMapData+"====>inncodeId3===>"+inncodeMapData.get(inncodeID+""));
        Map<String,Object> inncodeItemMap = (Map<String,Object>)inncodeMapData.get(inncodeID+"");
        StringBuilder znbscjgwStr = new StringBuilder();//创建人
        StringBuilder znbssjgwwStr = new StringBuilder();//收件人
        StringBuilder znbscsgwwStr = new StringBuilder();//抄送人
        StringBuilder znbszxgwcsStr = new StringBuilder();//智能部署-职能部门抄送
        String relationshipForUfZnbs=(String) inncodeItemMap.get("relationship");
//        mapOneDataMap.put("znbscjgw", recordSetRaci.getString("znbscjgw"));//rasi表里面的创建岗位
//        mapOneDataMap.put("znbssjgw", recordSetRaci.getString("znbssjgw"));//rasi表里面的收件岗位
//        mapOneDataMap.put("znbscsgw", recordSetRaci.getString("znbscsgw"));//rasi表里面的抄送岗位

//        for (Map<String, Object> stringObjectMap : v) {

//
//        }
        String yrmtnbr="";
        for (Map<String, Object> stringObjectMap : v) {
            hotelStr.append(stringObjectMap.get("INNCODE")).append(",");
            yrmtnbr=stringObjectMap.get("yrmtnbr")+"";
            raciStrValue.append(stringObjectMap.get("RACISZ")).append(",");

            znbscjgwStr.append(stringObjectMap.get("znbscjgw")).append(",");
            znbssjgwwStr.append(stringObjectMap.get("znbssjgw")).append(",");
            znbscsgwwStr.append(stringObjectMap.get("znbscsgw")).append(",");
            znbszxgwcsStr.append(stringObjectMap.get("znbszxgwcs")).append(",");
            gfxzsxxStr.append(stringObjectMap.get("id")).append(",");
            rasiValueList.put( stringObjectMap.get("MTRX")+"",Double.parseDouble(stringObjectMap.get("RiskValue") == null ? "0" : stringObjectMap.get("RiskValue")+""));
            List idsItemList=new ArrayList<>();
            idsItemList.add(stringObjectMap.get("id"));
            idsList.add(idsItemList);
        }
        raciStrValue= distainStr(raciStrValue);
        znbscjgwStr=distainStr(znbscjgwStr);
        ////logger1.info("cjGangValue==>"+znbscjgwStr+"===>v===>"+JSONUtil.toJSONString(v)+"====>region===>"+(inncodeItemMap.get("region")+""));
        znbssjgwwStr=distainStr(znbssjgwwStr);
        znbscsgwwStr=distainStr(znbscsgwwStr);
        znbszxgwcsStr=distainStr(znbszxgwcsStr);
        gfxzsxxStr=distainStr(gfxzsxxStr);
        beanParamsTwo.add("1");//任务生成方式=0手动发送，1智能发送
        beanParamsTwo.add((ufPhMapDataMap!=null&&(ufPhMapDataMap.get("jbxx")+"").equals("1"))? "1":"0");
        beanParamsTwo.add(yrmtnbr);
        beanParamsTwo.add(getAllDqIdsList(inncodeItemMap));//gldq管理大区
        beanParamsTwo.add(gfxzsxxStr.toString());//高风险表id集合
        beanParamsTwo.add("1");//0已发送,1:未发送
        beanParamsTwo.add(raciStrValue.toString());
        //风险系统 字段待确认 已确认不用了
        if (hotelStr.toString().lastIndexOf(",") != -1) {
            ////logger1.info("hotelStrBerfore===>" + hotelStr);
            hotelStr = new StringBuilder(hotelStr.substring(0, hotelStr.lastIndexOf(",")));
            ////logger1.info("hotelStrEndAfter===>" + hotelStr);
        }
        if (zszsStr.toString().lastIndexOf(",") != -1) {
            ////logger1.info("zszsStrBerfore===>" + hotelStr);
            zszsStr = new StringBuilder(zszsStr.substring(0, zszsStr.lastIndexOf(",")));
            ////logger1.info("zszsStrEndAfter===>" + zszsStr);
        }
        //酒店名字集合合并
        List<List> hotelList = new ArrayList<>();
        String[] split = hotelStr.toString().split(",");
        for (String s : split) {
            List<Object> itemList=new ArrayList<>();
            itemList.add(s);
            hotelList.add(itemList);
        }
        String hotelInfoSqlListSql = "select * from v_Commercial where "+ Util.getSubINClause(StrUtil.join(",",hotelList),"id","in");
        RecordSet hotleINfORecord = new RecordSet();
        ////logger1.info("hotelInfoSqlListSql=======>" + hotelInfoSqlListSql);
        boolean htoelFindData = hotleINfORecord.execute(hotelInfoSqlListSql);
        StringBuilder htoelNameStr = new StringBuilder();
        StringBuilder htoelNameEnglish = new StringBuilder();
        while (hotleINfORecord.next()) {
            htoelNameStr.append(hotleINfORecord.getString("hotelnamezh"));
            htoelNameEnglish.append(hotleINfORecord.getString("hotelname"));
        }
        beanParamsTwo.add(finalRwbqId +"");
        ////logger1.info("htoelNameStr====>"+htoelNameStr);
        beanParamsTwo.add(htoelNameStr.toString());//酒店名称
        beanParamsTwo.add(htoelNameEnglish.toString());//酒店名称jdmcy
        beanParamsTwo.add(htoelNameEnglish.toString());//酒店名称jdmcy2
        beanParamsTwo.add(inncodeID+"");//酒店指数代码
        beanParamsTwo.add(htoelNameStr.toString());//酒店名称
        String[] arrayStrTwo = zszsStr.toString().split(",");
        List<String> zzZHishuList = new ArrayList<>(Arrays.asList(arrayStrTwo));
        zzZHishuList=zzZHishuList.stream().distinct().collect(Collectors.toList());
        zszsStr=new StringBuilder(StrUtil.join(",",zzZHishuList));
        beanParamsTwo.add(zszsStr.toString());//致胜指数
        String selectuf_systemconfig = "select paramvalue from uf_systemconfig where uuid='hotle_title'";//找到开发系统配置表中的任务标题配置值
        RecordSet ufSYsteRecordSet = new RecordSet();
        ufSYsteRecordSet.execute(selectuf_systemconfig);
        Map ytmR = new HashMap<>();
        //问题:取哪个指数的YR_MT_NBR
        if (v.size() > 0) {
            ytmR = v.get(0);
        }
        if (ufSYsteRecordSet.next()) {
            beanParamsTwo.add(ufSYsteRecordSet.getString("paramvalue") + "-" + ((ytmR.get("yrmtnbr") == null ? "" : ytmR.get("yrmtnbr"))) );//rwbt 任务标题 要取指数对应的模板库里面的符合规则的，取出来的模板。
        } else {
            beanParamsTwo.add("" + "-" + ((ytmR.get("yrmtnbr") == null ? "" : ytmR.get("yrmtnbr"))));//酒店任务标题
        }
        //beanParamsTwo.add(1); //任务类型,等生成以后，根据收件人去酒店岗位表找，和中心岗位表找
//        ////logger1.info("htoelFindData========>11111111" + htoelFindData);
//            recordSet.executeSql("select isremark,isreminded,preisremark,id,groupdetailid,nodeid,
//            (CASE WHEN isremark=9 THEN 0.99 WHEN isremark=11 THEN 0.98 WHEN (isremark=1 and takisremark=2) THEN 0.9 WHEN
//            (preisremark=1 and isremark=2) THEN 1.9 WHEN (isremark=0 and takisremark = -2 and isInMultiTak = 1) THEN 2  ELSE isremark END)
//            orderisremark from workflow_currentoperator where requestid=" + requestid + " and userid=" + userid
//                    + " and usertype=" + usertype + "  and islasttimes = 1 order by orderisremark,id");

        //根据RACI设置制胜指数找出来相应的接收人，生成为创建人， 接收人，抄送人

        //11
//            for (Double aDouble : rasiValueList) {
//                sqlZHishuStr.append(" or fxzmin contact( select xyh from ( select (CASE WHEN xyh=0 THEN u5.fxzmin-").append(aDouble).append(" WHEN xyh=1 THEN '<=' ELSE xyh END) as xyh  from uf_indexsetting u2 where u5.id=id) u3 ) ");
//            }
        //使用程序里面进行判断



        StringBuilder cjRHrmresouce=new StringBuilder();
        StringBuilder jsRHrmresouce=new StringBuilder();
        StringBuilder ccHrmresouce=new StringBuilder();


        long forSystemTimeStart=System.currentTimeMillis();
        excuteSupporetRole(cjRHrmresouce,logger1,inncodeID,znbscjgwStr,"hotelrole","uf_Master_Hotel_Role");
        excuteSupporetRole(cjRHrmresouce,logger1,inncodeID,znbscjgwStr,"SupportRole","uf_zczx");


        excuteSupporetRole(jsRHrmresouce,logger1,inncodeID,znbssjgwwStr,"hotelrole","uf_Master_Hotel_Role");
        excuteSupporetRole(jsRHrmresouce,logger1,inncodeID,znbssjgwwStr,"SupportRole","uf_zczx");

        excuteSupporetRoleCC(ccHrmresouce,logger1,inncodeID,znbscsgwwStr,"hotelrole","uf_Master_Hotel_Role");
        excuteSupporetRoleCC(ccHrmresouce,logger1,inncodeID,znbscsgwwStr,"SupportRole","uf_zczx");

        excuteSupporetRoleCC(ccHrmresouce,logger1,inncodeID,znbszxgwcsStr,"hotelrole","uf_Master_Hotel_Role");
        excuteSupporetRoleCC(ccHrmresouce,logger1,inncodeID,znbszxgwcsStr,"SupportRole","uf_zczx");
        long forEndSystemTimeend=System.currentTimeMillis();

        //logger1.info("for4444444444============>"+(forEndSystemTimeend-forSystemTimeStart)+"===>ms");
//        if (cjRHrmresouce.toString().lastIndexOf(",") != -1) {
//            ////logger1.info("cjRHrmresouceStrBeforfe===>" + cjRHrmresouce);
//            cjRHrmresouce = new StringBuilder(cjRHrmresouce.substring(0, cjRHrmresouce.lastIndexOf(",")));
//            ////logger1.info("cjRHrmresouceEndAfter===>" + cjRHrmresouce);
//        }
//        if (jsRHrmresouce.toString().lastIndexOf(",") != -1) {
//            ////logger1.info("jsRHrmresouceStrBeforfe===>" + jsRHrmresouce);
//            jsRHrmresouce = new StringBuilder(jsRHrmresouce.substring(0, jsRHrmresouce.lastIndexOf(",")));
//            ////logger1.info("jsRHrmresouceEndAfter===>" + jsRHrmresouce);
//        }
//        if (ccHrmresouce.toString().lastIndexOf(",") != -1) {
//            ////logger1.info("ccHrmresouceBeforfe===>" + ccHrmresouce);
//            ccHrmresouce = new StringBuilder(ccHrmresouce.substring(0, ccHrmresouce.lastIndexOf(",")));
//            ////logger1.info("ccHrmresouceEndAfter===>" + ccHrmresouce);
//        }
//        String filedNameStr="jdmc,jddm,zszs,rwbt,cjgw,sjgw,csgw,cjgwry,sjgwry,csgwry,formmodeid,dymb,rwlx,sftxrwjbxx,sftxrwnr,znbszt,rwhdlx,xscfj,rwdqsj,rwnr,xgfj,modedatacreatedate,modedatacreatetime";
        cjRHrmresouce=distainStr(cjRHrmresouce);
        jsRHrmresouce=distainStr(jsRHrmresouce);
        ccHrmresouce=distainStr(ccHrmresouce);
        //logger1.info("ccHrmresouce=====>"+ccHrmresouce);
//        ccHrmresouce=distainStr(ccHrmresouce);

        beanParamsTwo.add(StrUtil.isBlank(znbscjgwStr.toString())?null:znbscjgwStr.toString());//cjgw 创建岗位
        beanParamsTwo.add(StrUtil.isBlank(cjRHrmresouce.toString())?null:cjRHrmresouce.toString());//cjgwry 创建岗位人员
//        beanParamsTwo.add(znbssjgwwStr.toString());//sjgwry 收件岗位
        beanParamsTwo.add(StrUtil.isBlank(jsRHrmresouce.toString())?null:jsRHrmresouce.toString());//sjgwry 收件岗位人员
        beanParamsTwo.add(StrUtil.isBlank(ccHrmresouce.toString())?null:ccHrmresouce.toString());//csgwry 抄送岗位
        //logger1.info("znbsjgwStr===>"+znbscjgwStr);
        //logger1.info("cjRHrmresouce===>"+cjRHrmresouce);
        //logger1.info("jsRHrmresouce===>"+jsRHrmresouce);
        //logger1.info("ccHrmresouce===>"+ccHrmresouce);
        //logger1.info("relationshipForUfZnbs===>"+relationshipForUfZnbs);


//        beanParamsTwo.add(ccHrmresouce.toString());//csgwry 抄送岗位人员


        beanParamsTwo.add(relationshipForUfZnbs);//jdlx 酒店类型

        beanParamsTwo.add(finalFormmodeid+"");//formmid

//        ////logger1.info("zszsStr111===>"+zszsStr);
        Map<String,StringBuilder> detailCountMap=new HashMap<>();
//        map.put("reusltModulIds",reusltModulIds);
//        map.put("zszsIdsStr",zszsIdsStr);
        Map<String, Object> map = reusltModulIdsLsit(inncodeMapData, zszsStr, inncodeID, logger1, null, detailCountMap);
//        logger1.info("map====>"+JSONUtil.toJSONString(map)+"====>inncode===>"+inncodeID);
        List<String > reusltModulIds=(List<String>)map.get("reusltModulIds");

        List<String > zsIdsListName=(List<String>)map.get("zsIdsListName");
        Map<String,String> dyZshListMap=(Map<String,String>)map.get("dyZshListMap");
        Map<String,List<String>> itemZsDyModuId=(Map<String,List<String>>)map.get("itemZsDyModuId");
        beanParamsTwo.add(detailCountMap.get("gzkIds")==null?"":detailCountMap.get("gzkIds").toString());
//        ////logger1.info("resultMOduleIds==>"+JSONUtil.toJSONString(reusltModulIds));
        beanParamsTwo.add(StrUtil.join(",", reusltModulIds));// 调用模板
//            //任务类型
        int jdorDqIdValue=findAllRevieverLogindEquals(Arrays.asList(znbssjgwwStr.toString().split(",")))? 1 : 0;
        beanParamsTwo.add(jdorDqIdValue+"");//1:酒店任务,0:大区任务
        beanParamsTwo.add(znbssjgwwStr.toString());//酒店岗位放raci的收件岗位znbm sjgw
        beanParamsTwo.add(znbssjgwwStr.toString());//职能岗位放raci的收件岗位
        beanParamsTwo.add(znbscsgwwStr.toString());//酒店岗位放raci的抄送岗位
        beanParamsTwo.add(znbszxgwcsStr.toString());//职能岗位放raci的抄送岗位
        String findDqManger="select a.adminname as adminName from uf_rolegroup a where a.managementregion='"+getAllDqIdsList(inncodeItemMap)+"' and a.txxz like '%"+znbscjgwStr.toString()+"%' limit 0,1";

        ////logger1.info("findDqManger=======>"+findDqManger);
        RecordSet recordSet1=new RecordSet();
        recordSet1.execute(findDqManger);
        if(recordSet1.next()){
            beanParamsTwo.add(recordSet1.getString("adminName"));
        }else {
            beanParamsTwo.add(null);
        }
//        beanParamsTwo.add(1);//znbszt 智能部署状态
//            ////logger1.info("beanParamsTwo======>" + JSONUtil.toJSONString(beanParamsTwo));
//

        Map onMathRuleMap = matchRuleFirsetModule(reusltModulIds, logger1);//任务符合的map 字段值
        ////logger1.info("onMathRuleMap======>"+JSONUtil.toJSONString(onMathRuleMap));
        //rwhdlx,xscfj,rwdqsj,rwnr";//任务互动类型,	需上传附件,任务到期时间,任务内容
        ////logger1.info("rwhdlx========>"+onMathRuleMap.get("rwhdlx")+"========xscfj=====>"+onMathRuleMap.get("xscfj")+"=======>rwdqsj====>"+onMathRuleMap.get("rwdqsj"));
        beanParamsTwo.add(StrUtil.isBlankIfStr(onMathRuleMap.get("rwhdlx"))?null:onMathRuleMap.get("rwhdlx"));//任务互动类型
        beanParamsTwo.add(StrUtil.isBlankIfStr(onMathRuleMap.get("xscfj"))?null:onMathRuleMap.get("xscfj"));//需上传附件
        beanParamsTwo.add(StrUtil.isBlankIfStr(onMathRuleMap.get("rwdqsj"))?null:onMathRuleMap.get("rwdqsj"));//任务到期时间
        Map<String,Object> otherMap=bulidTaskContent(reusltModulIds,detailCountMap,zsIdsListName,dyZshListMap,itemZsDyModuId);
        ////logger1.info("otherMap====>"+otherMap);
        StringBuilder stringBuilder = (StringBuilder) otherMap.get("rwnr");
        StringBuilder stringBuilderTwo =(StringBuilder) otherMap.get("fjsc");
        ////logger1.info("zszsStr===>"+zszsStr+"==stringBuilderString===>"+stringBuilder+"====>stringBuilderTwo=======>"+stringBuilderTwo);
        String content=StrUtil.isBlank(stringBuilder)?engListhTilte:stringBuilder.toString();
        ////logger1.info("content==>"+content);
        beanParamsTwo.add(content);//任务内容
        beanParamsTwo.add(stringBuilderTwo.toString());//相关附件

        //进行清空字段值 或者对字段值进行校验
//        String taskBaseInfoStr = "zsInformation,csInformation";//指数信息,参数信息
//        String contentFiledStr = "rwhdlx,xscfj,rwhdlx,rwnr,dymb,xgfj";//任务互动类型,需上传附件,任务到期时间,任务内容,调用模板,调用模板相关附件
        String contentFiledStr = "rwhdlx,xscfj,rwdqsj,rwnr";//任务互动类型,需上传附件,任务到期时间,任务内容
        String jcjrwStr="rwbt,rwlx,jdmc,jddm,zszs,sjgwry,cjgwry";//仅创建任务===>基本信息   字段信息,任务标题,任务类型,酒店名称,酒店代码,致胜指数,收件岗位人员,创建岗位人员
        //偏好设置表中，基本信息的时候，字段值如下:
        int wirteBaseINfo = 0;//是否填写任务基本信息 是=0，否=1
        int wirteTaskConten = 0;//是否填写任务内容是=0，否=1
//        ////logger1.info("ufPhMapDataMap======>"+JSONUtil.toJSONString(ufPhMapDataMap));

//        else {
//            String[] taskBaseInfoStrArray = taskBaseInfoStr.split(",");
//            for (int i = 0; i < taskBaseInfoStrArray.length; i++) {
//                beanParamsTwo.set(fileNameStrList.lastIndexOf(taskBaseInfoStrArray[i]), null);
//            }
//        }
        if(ufPhMapDataMap==null){
            ufPhMapDataMap=new HashMap<>();
        }
        ////logger1.info("inncodeID===>"+inncodeID+"====>ufPhMapDataMap=====>"+JSONUtil.toJSONString(ufPhMapDataMap));
        if ("1".equals(ufPhMapDataMap.get("jcjrw") + "")) {//1代表check框勾选了
            beanParamsTwo.add("0");

            String[] jcjrwStrArray = jcjrwStr.split(",");
            for (int i = 0; i < jcjrwStrArray.length; i++) {
                Object o = beanParamsTwo.get(fileNameStrList.lastIndexOf(jcjrwStrArray[i]));
                if(jcjrwStrArray[i].equalsIgnoreCase("sjgwry")){
                    //logger1.info("inncode===>"+inncodeID+"====>j====>i===>"+jcjrwStrArray[i]+"===>o==>"+o);
                }
                if (o == null||"".equals(o)||"-1".equals(o)) {
                    wirteBaseINfo = 1;
                    break;
                }
            }
        }else {
            Object o = beanParamsTwo.get(fileNameStrList.lastIndexOf("sjgwry"));
            if (o == null||"".equals(o)||"-1".equals(o)) {
                wirteBaseINfo = 1;
            }

            Object o2 = beanParamsTwo.get(fileNameStrList.lastIndexOf("cjgwry"));
            if (o2 == null||"".equals(o2)||"-1".equals(o2)) {
                wirteBaseINfo = 1;
            }
            beanParamsTwo.add("0");
        }

//        ////logger1.info("inncodeValueForRwnr===>"+inncodeID+"====>rwNrValue111===>"+ufPhMapDataMap.get("rwnr"));
        //偏好设置表中,任务内容的时候,字段值如下:
        if ("1".equals(ufPhMapDataMap.get("rwnr") + "")) {//1代表check框勾选了
//            ////logger1.info("inncode===>"+inncodeID+"===>rwnrValue====>"+ufPhMapDataMap.get("rwnr") );
            String[] contentFiledStrArray = contentFiledStr.split(",");
//            ////logger1.info("contentFiledStrArray===>"+Arrays.toString(contentFiledStrArray));
            for (int i = 0; i < contentFiledStrArray.length; i++) {
//                ////logger1.info("i=========>"+i+"======indexValue===>"+fileNameStrList.lastIndexOf(contentFiledStrArray[i]));
                Object o = beanParamsTwo.get(fileNameStrList.lastIndexOf(contentFiledStrArray[i]));
//                ////logger1.info("i=========>"+i+"===>o====>"+o);
                if (o == null || "".equals(o) || "-1".equals(o) || o.toString().contains(engListhTilte)) {
                    wirteTaskConten = 1;
                    break;
                }
            }
            beanParamsTwo.add("0");
        }else{
            String[] contentFiledStrArray = contentFiledStr.split(",");
//            ////logger1.info("contentFiledStrArray===>"+Arrays.toString(contentFiledStrArray));
            for (int i = 0; i < contentFiledStrArray.length; i++) {
//                ////logger1.info("i=========>"+i+"======indexValue===>"+fileNameStrList.lastIndexOf(contentFiledStrArray[i]));
                Object o = beanParamsTwo.get(fileNameStrList.lastIndexOf(contentFiledStrArray[i]));
//                ////logger1.info("i=========>"+i+"===>o====>"+o);
                if (o == null || "".equals(o) || "-1".equals(o) || o.toString().contains(engListhTilte)) {
                    wirteTaskConten = 1;
                    break;
                }
            }
            beanParamsTwo.add("0");
        }
//        else {
//            String[] contentFiledStrArray = contentFiledStr.split(",");
//            for (int i = 0; i < contentFiledStrArray.length; i++) {
//                beanParamsTwo.set(fileNameStrList.lastIndexOf(contentFiledStrArray[i]), null);
//            }
//        }
        beanParamsTwo.add(wirteBaseINfo);//是否填写了基本信息 下拉框字段值 是=0,否=1
        beanParamsTwo.add(wirteTaskConten);//是否填写任务内容 是=0，否=1 下拉框字段值
        if (wirteTaskConten == 1 || wirteBaseINfo == 1||content.contains(engListhTilte)) {
            beanParamsTwo.add(1);//部署状态 0=参数满足,1=不满足,2=部分满足
        } else {
            beanParamsTwo.add(0);
        }
        ////logger1.info("wirteBaseINfo=====>"+wirteBaseINfo+"====>wirteTaskConten===>"+wirteTaskConten);

        beanParamsTwo.add(format);//modedatacreatedate
        beanParamsTwo.add(timeStr);//modedatacreatetime
        finalRealParams.add(beanParamsTwo);
    });

    //找到所有的高风险表的id值,设置成已经发送
//
    long endTimeMillsecond = System.currentTimeMillis();
    //logger1.info("for2===>excuteTwoTask11111111111111=======endTimeMillsecond=========>"+(endTimeMillsecond-startSecondTime)+"===>ms");
//        insert into uf_znbsqd (jdmc,jddm,zszs,rwbt,cjgw,sjgw,CsgW,cigwry,sjgwry,csgwry) values(??????????)
    realParams=finalRealParams.stream().distinct().collect(Collectors.toList());
    ////logger1.info("realParams========>" + JSONUtil.toJSONString(realParams));
    boolean insetToTaskList = false;
    long endInsertSqlTimeStart=System.currentTimeMillis();
    insetToTaskList = new RecordSet().executeBatchSql(insertTaskSql, realParams);
    if(insetToTaskList){
        if(!idsList.isEmpty()){
            RecordSet batchRecordSet=new RecordSet();
            ////logger1.info("idsList===>bUpdateSfFs===>"+JSONUtil.toJSONString(idsList));
            boolean bUpdateSfFs = batchRecordSet.executeBatchSql("update uf_gfxzsxxgl set sfyscdfqd=0 where id in (?)", idsList);
            ////logger1.info("bUpdateSfFs=======>"+bUpdateSfFs);
        }
    }
        long endSqlTimeStart=System.currentTimeMillis();
        //logger1.info("forend2222222222===>" + (endSqlTimeStart-endInsertSqlTimeStart)/1000+"s");
        addDetailDataMethod(inncodeMapData,logger1,inncodeList);
////
//        ExecutorService executor = Executors.newFixedThreadPool(15);
//
//// 提交Runnable任务
//        executor.execute(() -> {
//
//
////            System.out.println("Task executed by " + Thread.currentThread().getName());
//        });
//
//// 提交Callable任务
//        Future<String> future = executor.submit(() -> {
//
//            return "Task result";
//        });
//
//// 获取任务结果
//        try {
//            String result = future.get();
//            //logger1.info("Task result: " + result);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }


    } catch (Exception e) {
        logger1.info("eRRor===>"+e);
            e.printStackTrace();
    }



%>
